Server: Better error handling and provide error details

This commit is contained in:
Raúl Marín
2020-11-17 17:41:54 +01:00
parent 151d8f01e4
commit 314e709f3b
5 changed files with 7 additions and 6 deletions

View File

@@ -105,7 +105,7 @@ class MapboxIsolines():
elif response.status_code == requests.codes.unprocessable_entity:
return []
else:
raise ServiceException(response.status_code, response)
raise ServiceException('Unexpected response (' + str(response.status_code) + '): ' + str(response.content), response)
except requests.Timeout as te:
# In case of timeout we want to stop the job because the server
# could be down

View File

@@ -94,7 +94,7 @@ class MapboxRouting(Traceable):
elif response.status_code == requests.codes.unprocessable_entity:
return MapboxRoutingResponse(None, None, None)
else:
raise ServiceException(response.status_code, response)
raise ServiceException('Unexpected response (' + str(response.status_code) + '): ' + str(response.content), response)
except requests.Timeout as te:
# In case of timeout we want to stop the job because the server
# could be down

View File

@@ -82,7 +82,7 @@ class TomTomIsolines():
elif response.status_code == requests.codes.unprocessable_entity:
return []
else:
raise ServiceException(response.status_code, response)
raise ServiceException('Unexpected response (' + str(response.status_code) + '): ' + str(response.content), response)
except requests.Timeout as te:
# In case of timeout we want to stop the job because the server
# could be down

View File

@@ -120,7 +120,7 @@ class TomTomRouting(Traceable):
elif response.status_code == requests.codes.unprocessable_entity:
return TomTomRoutingResponse(None, None, None)
else:
raise ServiceException(response.status_code, response)
raise ServiceException('Unexpected response (' + str(response.status_code) + '): ' + str(response.content), response)
except requests.Timeout as te:
# In case of timeout we want to stop the job because the server
# could be down