-
-
Notifications
You must be signed in to change notification settings - Fork 560
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
The big error refactor #2566
The big error refactor #2566
Conversation
2c5a9b5
to
5b6b286
Compare
There's one issue on
|
Didn't get to this today, but will take a look tomorrow. Feel free to message me if there's anything else you need from me tomorrow (stuff to land aside from pipe2, I mean). |
5b6b286
to
7572686
Compare
0444b8f
to
acad2f4
Compare
Progress updateI talked to @thomcc and I think we should push through with the error refactoring on this branch. It'll create too much breakage everywhere else (looking at CI...) if we do this gradually. So let's just pull off the bandaid. Some thoughts on the new error system and how we should use it below Crate-local vs module-local error typesCurrently we have crate-local error types for node, ockam, transport, etc. For some of these systems a crate-wide error type makes sens. But for other things they don't. Because the underlying error types are more flexible we can have more granular Error types. Any underlying failure information (for example from a bad serialisation, etc) should then be included in the local error type. Following is an incomplete list of error types we need to re-introduce into this system:
... to be expanded Updated crates
|
d75c4ad
to
55af930
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This largely looks good to me. Someone else should review ockam_core::error::* though, since I wrote that code.
#[cfg(test)] | ||
mod test { | ||
use ockam_core::compat::collections::HashMap; | ||
// #[cfg(test)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably just delete.
ockam_core::Error::new(BleError::DOMAIN_CODE + e.code(), BleError::DOMAIN_NAME) | ||
impl From<BleError> for Error2 { | ||
fn from(err: BleError) -> Error2 { | ||
Error2::new(ErrorCode::new(Origin::Transport, Kind::Io), err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of these should have more specific categories. E.g. timeout, etc.
bc5a803
to
84484e9
Compare
That said this all revealed some serious flaws in this design! In particular, the no_std error handling becomes extremely painful. Use of Regarding other failures: I think the FFI error changes may need to be reverted entirely -- Elixir failing means the are probably depending on some error code being a specific value. That, or you can fix the elixir (I'm unsure how widespread it is, and suspect our tests catching it may be luck (since I'd guess our elixir code does not test coverage of error handling much). That said, FfiError can be its own thing for a bit, since ockam-ffi is not a dependency of anything rust stuff. (EDIT: actually, it doesn't seem to be failing now maybe? IDK) |
@spacekookie Alright, I think that's all the CI failures, but you can take anything that's left (and the rebase). |
Well that's disappointing. I thought it supported
Yea true, I first added the Anyway, thanks for pushing it across the finish line. I'll give it another round of review today and then I think we should merge this ASAP before something else needs to be re-based |
Interestingly enough there's a |
This commit marks some tests as "ignore" because the constraints they were checking for don't exist anymore. We should evaluate each test in accordance of its constraints and then re-write them for the new system
This commit adds a new class of crate error to ockam_node while refactoring the previous `RouterError`. The new error types map onto classes of problems, which interact with the `Kind` system introduced by ockam_core and attaching any relevant causing errors via the `.context(..)` mechanism.
e34867e
to
c553fb9
Compare
57d8a53
to
61d539b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's more to do here but can mostly be done in a follow up. Thanks! I'll be merging this.
(original message) This PR is a current rebase and fix of #2492, while also applying its changes to how
ockam_node
uses error data.Current state
What a massive refactor this is turning out to be but I think we're almost there.
ockam_core::old_error
withockam_core::Error2
Error2
toError
Error2
API to remove requirement forErrorCode
to be publicKind
types for crate-local errors (currently I've mostly chosenMisuse
andInvalid
. This is not accurate for all wrapped error types and we should have a think about how we classify each category of error to find the most appropriate mapping. More importantly: do we want to encourage users to handle different kinds of errors differently? Or should we do so internally? i.e. panic on some but not others?)no_std
usage