Skip to content

Lookup method can raise HTTP 400 with errors body #27

@chkwok

Description

@chkwok

When looking up a phone number to do preliminary validation, the API can raise a HTTPError instead of ErrorException, as the HTTP status code 400 is not handled in the client.

Raising an ErrorException would be more consistent, as a HTTPError usually indicates networking errors or bad requests, not "phone number seems invalid".

Sample response:

x
Out[91]: requests.exceptions.HTTPError('400 Client Error: Bad Request for url: https://rest.messagebird.com/lookup/1234567890')

x.response.content
Out[92]: b'{"errors":[{"code":21,"description":"Bad request (phone number has unknown format)","parameter":"phone_number"}]}\n'```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions