Closed dbartenstein closed 3 years ago
Very likely the request did not return a JSON body after five minutes, thus body = response.json()
failed and the simplejson.errors.JSONDecodeError
was raised.
https://github.com/smartcar/python-sdk/blob/master/smartcar/requester.py#L31
response.json()
for certain status codes or wrap it inside a try - except block?As a developer I want to call actions via Smartcar’s Python SDK and not having to catch any other exceptions than those derived from SmartcarException
.
Hello @dbartenstein, thanks for raising this issue. During that brief window you mentioned, Smartcar's API had an issue where a small subset of errors were not returning the our standard JSON error format. The issue has since been fixed and we do not expect this situation to arise again.
That being said, we like your suggestion to have all SDK errors bubble up to the developer as a SmartcarException
. We will put up a PR to implement this and we'll leave this issue open until it is merged.
Fixed by #84
On September 10th, 2020 between 7 p.m. and 8 p.m. CEST we faced issues when using Smartcar’s API to communicate with Tesla vehicles. After five minutes a
simplejson.errors.JSONDecodeError
exception was thrown.Wouldn’t it be nicer to have that exception wrapped in a
SmartcarException
with additional information about what caused the error?