Skip to content

When item can't be retrieved, exception TypeError is thrown instead of KeyError #7

@EEWatanabe

Description

@EEWatanabe

In line 57 of _init.py, when item can't be retrieved, exception TypeError is thrown instead of KeyError

        raise (KeyError, "Key: %s does not exist." % key)

The error message is misleading:

        TypeError: exceptions must derive from BaseException

It is because it is trying to raise an exception of type "tuple", that obviously is not an exception.

The correct code would be:

        raise KeyError("Key: %s does not exist." % key)

The correct error message would be:

        KeyError: Key: **key** does not exist.

It is just a misplaced parentheses.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions