-
Notifications
You must be signed in to change notification settings - Fork 288
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
multi: define wire error types. #2055
Conversation
63b7f99
to
ae20fb9
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.
Just a couple of suggestions for the design of ErrorCode
and MessageError
. I'm not sure whether these were already considered or not so I'm just recording them here.
Feel free to ignore them if this has already been discussed and the design of the error structures explicitly decided as they were implemented.
ae20fb9
to
2127ff1
Compare
How are these error codes going to be used to solve the linked issue? I'm not sure what the plan is with them or why they are necessary. |
Errors generated processing messages from peers can now be checked if they're bannable or not with these definitions. Take a look at |
ba981fe
to
404ccb6
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.
So, now that the intent is to create more programmatically identifiable errors, I would highly recommend that the textual prefix of the function in the error messages be removed in favor a new field in the Error
struct which identifies the originating message. That way it's not only possible to switch on the specific error code, but the origin message type could also be examined. I can foresee that being an important distinction as something more generic like ErrInvalidMsg
might have different behavior depending on the specific type of message.
It will also significantly clean up the error messages and reduce the need to repeat the function name constantly, which is error prone and I would be willing to bet there are cases where it's not even correct anyway.
I agree, adding the originating message to the error as you stated should clean up the error message, reduce the function name repetition and also provide more context. I'm going to get that done in a different PR. |
404ccb6
to
6e6ec07
Compare
6e6ec07
to
681104e
Compare
681104e
to
8daaad6
Compare
This updates the wire error type by clearly defining package errors and updating call sites.
8daaad6
to
bab06ce
Compare
This updates the wire error type by clearly defining package errors and updating call sites.
This is work towards #350.