Skip to content

Confusing handling of unexpected server response in fetch_token #302

@awbacker

Description

@awbacker

I am using fetch_token with the standard web client, but the server I am talking to returns a non-standard response (its just a text string saying 403/ bad auth ...).

The error I see is a MissingTokenError, rather than something more explanatory. This left me chasing my tail since I thought there was something wrong with the response, etc.

Ideas:

  • In the 403 case, re-raise that as an explicit error
  • In the "unexpected body" or "bad format", raise a BadResponseError or similar
  • Add status_code/resp.text to the exception as well, to help with debugging

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions