Skip to content

Implement ShadeError base exception class #15

Description

@codebestia

Description

All SDK-specific errors must inherit from a common ShadeError so callers can catch all SDK errors with a single except ShadeError. It should carry a human-readable message, the HTTP status_code (if applicable), and the raw response_body for debugging.

Proposed Steps

  • Create src/shade/errors.py.
  • Define ShadeError(Exception) with __init__(self, message, status_code=None, response_body=None).
  • Add __str__ returning a formatted string including the status code when present.
  • All other exceptions in this file must subclass ShadeError.

Acceptance Criteria

  • except shade.ShadeError catches all SDK errors.
  • str(error) includes both the message and the HTTP status code when present.
  • error.response_body contains the raw API response as a string.
  • ShadeError can be raised standalone (e.g. for contract-level errors with no HTTP context).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions