-
Notifications
You must be signed in to change notification settings - Fork 41
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
Refactors apiserver
errors to be module specific
#279
Conversation
apiserver/src/api/error.rs
Outdated
#[snafu(display("Unable to create client: '{}'", source))] | ||
ClientCreate { source: kube::Error }, | ||
|
||
pub enum ApiError { |
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.
Do you have preferences and any thoughts that make you keep this error.rs
? I think might be better to delete this file and move the ApiError module to mod.rs
? I'm not 100% confident that my way is better than yours. Love to hear your thoughts! thanks
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 made sense to live in it's own file since it denotes errors for the entire API module. I believe putting it in mod.rs
would essentially accomplish the same thing; make these errors accessible to entire module (but not necessarily the crate). Still new to the rust paradigms, so up to what y'all think!
apiserver/src/api/error.rs
Outdated
#[snafu(display("Unable to create client: '{}'", source))] | ||
ClientCreate { source: kube::Error }, | ||
|
||
pub enum ApiError { |
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.
Throughout our codebase (including other projects) we tend to use Error
for all error enums instead of giving them bespoke names.
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.
Sounds good! I was following some of the other examples found in brupop:
pub enum AuthorizationError { |
Maybe these are due for a small refactor?
Signed-off-by: John McBride <jpmmcb@amazon.com>
91804d5
to
ea44780
Compare
Force pushed:
|
Issue number:
Related: #121
Description of changes:
Refactors the
apiserver
error handling to be less generic and more module spcific.Testing done:
Coming soon
Terms of contribution:
By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.