python-intercom icon indicating copy to clipboard operation
python-intercom copied to clipboard

company_not_found raises an UnexpectedError when it should raise a ResourceNotFound error

Open hassa opened this issue 5 years ago • 0 comments

We expected company_not_found to raise a ResourceNotFound, but currently it raises an UnexpectedError

We tracked this down to: https://github.com/intercom/python-intercom/blob/master/intercom/errors.py#L68

I think company_not_found just needs to be mapped to ResourceNotFound

from intercom.client import Client

intercom = Client(personal_access_token='YOUR TOKEN')

try:
    intercom.companies.find(company_id='does not exist')
except Exception as e:
    print(type(e))

<class 'intercom.errors.UnexpectedError'>

hassa avatar Apr 08 '20 11:04 hassa