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.
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.