Skip to content

Improve error reporting when requests fail — retire "Expecting value: line 1 column 1 (char 0)", report HTTP code instead #15227

@talflon

Description

@talflon

There's a number of places in the code where .json() is called on a Requests response, without first checking if it failed. If it fails, it's not going to parse as JSON. Instead, we usually get:

requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I think it'd be nicer to instead raise the HTTP error code received, instead of the lack of a JSON object at char 0.

Does anyone have any objections to this change? Will there be nostalgia for line 1 column 1 (char 0)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: enhancementImprovements which don't reach the level of being new features.

    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