Skip to content
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

Return correct error variants for API errors #31

Merged
merged 1 commit into from
Sep 18, 2024
Merged

Conversation

robin-nitrokey
Copy link
Member

@robin-nitrokey robin-nitrokey commented Sep 9, 2024

Previously, the generated code did not properly take into account the HTTP status of error responses. We would either return *Error::UnknownError (if the response message was set) or a serde error otherwise.

With this patch, we map the status codes to the corresponding error variants and skip deserialization if the response body is empty.

Fixes: #30

Previously, the generated code did not properly take into account the
HTTP status of error responses.  We would either return
*Error::UnknownError (if the response message was set) or a serde error
otherwise.

With this patch, we map the status codes to the corresponding error
variants and skip deserialization if the response body is empty.

Fixes: #30
@robin-nitrokey robin-nitrokey merged commit 246825a into main Sep 18, 2024
6 checks passed
@robin-nitrokey robin-nitrokey deleted the errors branch September 18, 2024 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot get useful information when an error occurs
2 participants