Skip to content

Improve error handling usability #297

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
miere opened this issue Mar 11, 2021 · 4 comments
Closed

Improve error handling usability #297

miere opened this issue Mar 11, 2021 · 4 comments
Assignees

Comments

@miere
Copy link

miere commented Mar 11, 2021

As discussed at #294, there's room for usability/design improvement on how internal errors are handled.

I believe it would be beneficial if we remove the requirement to rewrite our own Error alias for each lambda endpoint. By simply making the existing one public would solve this problem. It would also allow the maintainers to create their own backward compatible Error type, with little to (possibly) zero impact on users of this library.

@rimutaka
Copy link
Contributor

@miere , I agree, but are you sure it will work? There was a discussion re this some time ago, if I recall it correctly. @softprops may remember the reason why it was done that way.

@softprops
Copy link
Contributor

I was a fan of the type alias for the record :)

The pros outweigh the cons for me.

Pros

  • concise while still flexible type api
  • easier migration path for users if the type changes. Most won't need to change their code

Cons

  • widens surface area (imports needed from this crate be ate lib)

There have been a few discussions in the past about using an external crate specific type. I try to stay clear for this because the rust ecosystem tends to change its taste for error crates every few years (error-chain, failure, anyhow, etc) which tends to become a maintenance burden for crates exporting those types. This end up breaking your api contracts by migrating your crate's error to the current trend. I do not enjoy this kind of work. I like the std library because it's by definition standard!

A type alias over std lib types seems like a happy medium for me

@coltonweaver
Copy link
Contributor

I tried my hand at the suggestion in #298. Let me know if you have any feedback!

@coltonweaver coltonweaver self-assigned this Mar 12, 2021
@coltonweaver
Copy link
Contributor

I've merged that change in now. Gonna close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants