-
Notifications
You must be signed in to change notification settings - Fork 321
Cosmos Errors #170
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
Cosmos Errors #170
Conversation
ctaggart
left a comment
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 is looking good. I will have to attempt updating the services to use thiserror.
thomastaylor312
left a comment
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.
|
I love it 👍 . I am curious on how you plan to use CosmosError to capture request specific errors. Do you plan to have different error enums each with a CosmosError variant along with the response specific ones? |
|
@MindFlavor which request specific errors do you mean? I believe most requests only error for fairly generic reasons (e.g., unexpected HTTP response status code, bad json, etc.) |
|
Sorry I have been cryptic 👼 ... I meant, do you mean to expand the CosmosError to capture the meaning of the returned errors? Right now we just return For example, instead of returning "UnexpectedHTTPStatusCode: we expected 200 but we've got 429 back" we could return a variant like What do you think? |
|
Closing this for now. I'll reopen with a new PR soon. |

This PR makes several large changes to how error propogation is done in the
cosmoscrate:CosmosErroran enum with all errors that are possible to get from using a cosmos API. Some of these will be simple wrappers around generic errors from other crates (e.g.,serde_json::Errorandazure_core::HeaderError)thiserrorfor declaring errors. Previously,cosmosusedfailurewhich has been deprecated in favor ofthiserror.