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

Provide more structural info in Error::BadResponse #202

Open
loyd opened this issue Feb 20, 2025 · 0 comments
Open

Provide more structural info in Error::BadResponse #202

loyd opened this issue Feb 20, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@loyd
Copy link
Collaborator

loyd commented Feb 20, 2025

Use case

Sometimes, it's useful to detect and handle specific errors on the client side (e.g., TOO_MANY_SIMULTANEOUS_QUERIES).
However, now Error::BadResponse contains only String, forcing users to use details.contains(code).

Describe the solution you'd like

Replace Error::BadResponse(String) with Error::BadResponse(BadResponseDetails) where BadResponseDetails contains code (numeric code), reason (string like TOO_MANY_SIMULTANEOUS_QUERIES) and message (the current String argument).

BadResponse is also used for HTTP errors, so we need to decide what should be stored in code and reason in this case. Another way is to divide BadResponse into two separate variants.

@loyd loyd added the enhancement New feature or request label Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant