Skip to content

Change to Github API message returned with 404 leads to UnknownObjectException not being raised #3179

@coltonb-arcadia

Description

@coltonb-arcadia

Expected Behavior

  • When retrieving a file that is not found, I expect a UnknownObjectException to be raised.

Actual Behavior

  • A GithubException is raised instead, because the error message is being explicitly checked here:

elif status == 404 and message == "not found":

The message is now verbose and references the missing object, instead of "not found".

This caused us to fail to catch an acceptable 404 and broke some things for us.

Workaround

# Before
except UnknownObjectException:
    # handle error

# After
except GithubException as e:
    if e.status != 404:
        raise e
    # handle error

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions