Skip to content

Provide more structural info in Error::BadResponse #202

@loyd

Description

@loyd

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions