Currently get_event(id) and get_group(id) raise built-in IndexError if id is not matched. NB IndexError subclasses base class LookupError.
Although I originally implemented this, I don't think it's correct, as (paraphasing docs) this is intended where an integer subscript is out of range; and id is str not int.
@ptmminh suggested ValueError (docs) but this should be:
raised when an operation or function receives an argument that has the right type but an inappropriate value, and the situation is not described by a more precise exception such as IndexError.
I think we should be more precise, and so it should be one of:
- built-in
KeyError (docs) which subclasses base class LookupError - as id is a key to a mapping (dict), even though it happens to be inside a list
- custom exception e.g.
IDMatchError which subclasses base class LookupError
Let me know what you think.
Currently
get_event(id)andget_group(id)raise built-inIndexErrorifidis not matched. NBIndexErrorsubclasses base classLookupError.Although I originally implemented this, I don't think it's correct, as (paraphasing docs) this is intended where an integer subscript is out of range; and
idisstrnotint.@ptmminh suggested
ValueError(docs) but this should be:I think we should be more precise, and so it should be one of:
KeyError(docs) which subclasses base classLookupError- asidis a key to a mapping (dict), even though it happens to be inside a listIDMatchErrorwhich subclasses base classLookupErrorLet me know what you think.