-
Notifications
You must be signed in to change notification settings - Fork 90
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
attestation-service: Refactor errors in attestation module #327
attestation-service: Refactor errors in attestation module #327
Conversation
75c19bd
to
693500c
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.
a couple of smaller remarks, but we're getting there
6c47bef
to
57e7d2e
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.
almost there, I think we need to keep the error messages specific when we refactor from anyhow!
or .context()
. pasted some examples in the recent comments to show how this can be achieved.
be0d242
to
4a8f6b3
Compare
4a8f6b3
to
7fb301b
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.
looks good, small nits from my side. @Xynnn007 comments should are left to be addressed, mostly adding {0}
to extend the error message, where appropriate.
7fb301b
to
223a62d
Compare
223a62d
to
3fdc977
Compare
Fixes: confidential-containers#231 Signed-off-by: Kartik Joshi <kartikjoshi@microsoft.com>
3fdc977
to
698ddc3
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.
lgtm, thanks for accommodating the comments
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.
Looks pretty good.
My only question is about how you chose the names for error enums. It seems like you are creating an enum for each file, but this might not be optimal. For instance we end up with the same errors in multiple enums (like the config error). It also means that the names of the enums aren't super meaningful. The RestfulError
enum contains a bunch of stuff that isn't realy related to Rest but is just part of that file. ServiceError
is a really general term.
I wonder if there is a way to break up the errors into different logical groups, e.g. ConfigError
, ProtocolError
, CryptoError
, and then share these enums between files.
I guess this isn't too big of a deal, though. If @Xynnn007 and @mkulke are happy with the PR then we can go ahead as is.
ah indeed, in some of those cases a per-file error doesn't make much sense, I agree. e.g. in the case of RestfulError & GrpcError, maybe they could be split into ProtocolError and ,idk, "ServiceError"? |
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.
Thanks @kartikjoshi21
Replace anyhow error crate with thiserror crate
Fixes: #231