-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Improve error type handling #543
Comments
We most likely want to use |
Would using a I suggested the FTR I'm not stuck on using |
It shouldn't be the box should only happen at the leaf level and get passed up the tree. Generally, you're able to use bounds like |
This is definitely something we've punted on for a little too long. That said, the error handling situation is a little in flux right now (see here and here) and I'm not sure there's an obviously correct direction for us to take. My understanding is that As a first step we should probably pick a component or two currently using |
So now, one error return has been converted to an actual error type. Where should this issue go from here? |
I would say we should take a quick inventory of components still using |
A quick grep shows at least the following modules:
|
Do we want this as separate PR for each refactoring (ex all the transforms have to be done at once) or one big PR when complete? |
@bruceg one commit per sink/source/transform works and then bunch them into their own PR. |
I've done all the (for example) transforms as one commit. Are you saying you would rather break them into separate commits per file (which won't actually compile until the last commit) or am I misunderstanding? |
@bruceg honestly, whatever is easier for you, I'm happy to review it either way. |
Yeah, please feel free to break it up however is easiest for you. |
AFAICT there is one last module that uses |
Do you mean just here? That one is so small and isolated I don't think it's worth the effort to do anything fancier. |
No, I mean the whole stack starting (roughly) here. There are a lot of routines that return |
I see, those evaded my grep as well. I wouldn't say they're high priority, and they might be a little different since we're collecting multiple errors. I'd say we can take a quick stab at them, but be ready to punt if it becomes much of a burden. There's some value to be had there, but not a ton. |
We can also change the signature to |
@bruceg just checking in on this. Do you mind letting us know what's left? So we can document it here. If nothing is left, feel free to close. |
The whole configuration parsing stack still uses |
@lukesteensen @bruceg would it make sense to introduce a custom That way, we can still have all config-related functions return the default boxed error trait object, but we can either a) downcast at the leaf to capture all individual errors, or b) have the |
I think the preferred path would be to introduce a |
@lukesteensen @bruceg is this still relevant? I think we do use |
I'm not sure that it's very high priority, but there is definitely still work that we could do to improve our error handling story. This initial pass at this used |
Closing this since we wouldn't pick it up for its own sake but only if we needed to better handle errors for some other reason. |
Many of Vector's methods use a
Result<_, String>
return type. This is adequate for textual errors, but it makes it impossible for users to pattern match on the error type as well as dropping any cause information encapsulated by some error types. We should switch to proper error types (similar tostd::io::Error
) probably aided by thefailure
crate.References:
The text was updated successfully, but these errors were encountered: