In the ruby library I've tried to catch most errors and bubble them up in a meaningful way. For example when I send a fax to a number that I'm not yet allowed to send a fax to I get:
fax=interfax.deliver(faxNumber: "+11111111112",file: 'spec/test.pdf')InterFAX::Client::BadRequestError: Badrequest(400): {"code":-111,"message":"Attempting to fax to a number that is not the designated fax number in a developer account","moreInfo":null}In this library I get
>>>fax=interfax.deliver(fax_number="+442084978650", files=["tests/test.pdf"])
Traceback (mostrecentcalllast):
File"<stdin>", line1, in<module>File"interfax/outbound.py", line20, indeliverfiles=self._generate_files(files))
File"interfax/client.py", line76, inpostreturnself._request('POST', url, **kwargs)
File"interfax/client.py", line89, in_requestreturnself._parse_response(request(method, url, **kwargs))
File"interfax/client.py", line117, in_parse_responseresponse.raise_for_status()
File"/Users/cbetta/.pyenv/versions/2.7.12/lib/python2.7/site-packages/requests/models.py", line862, inraise_for_statusraiseHTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400ClientError: BadRequestforurl: https://rest.interfax.net/outbound/faxes?faxNumber=%2B442084978650
In the ruby library I've tried to catch most errors and bubble them up in a meaningful way. For example when I send a fax to a number that I'm not yet allowed to send a fax to I get:
In this library I get