It would be nice if we can create a custom exception inherited from ValueError that takes in the filter name and incorrect value as parameters. This promotes more graceful error-handling in applications using pycraigslist.
I'm thinking something like this in pycraigslist.exceptions:
class InvalidFilterValue(ValueError):
def __init__(self, name, value):
self.name = name
self.value = value
Right now, the pycraigslist.query.filters.parse_filters() function throws ValueError with a string indicating a filter has an incorrect value.
It would be nice if we can create a custom exception inherited from ValueError that takes in the filter name and incorrect value as parameters. This promotes more graceful error-handling in applications using pycraigslist.
I'm thinking something like this in pycraigslist.exceptions: