GIScience / openrouteservice-js

:pushpin: The JavaScript API to consume openrouteservice(s) painlessly!
https://openrouteservice.org
Apache License 2.0
192 stars 35 forks source link

Return the full error object in OrsDirections #20

Closed amoncaldas closed 5 years ago

amoncaldas commented 5 years ago

Return the full error object in OrsDirections when the request fails.

As the Error constructor expects a string https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error somehow the Error class is getting the first property that is a string and using it in the constructor. Then the error returned is alsways a string and the consumer doesn't have access to the error details, like the error code.