shareandcharge / sharecharge-api

HTTP webserver for the Share&Charge e-Mobility Network
0 stars 0 forks source link

calling the info on a location that doesn't exist doesn't return an error code #4

Closed AndreiD closed 6 years ago

AndreiD commented 6 years ago

calling something like this: http://localhost:3000/api/store/locations/0x73d008c9d78109c95c54b936c56b3cdc7ca8252e/0x35312e3433333031322c372e3030343139

(node:18228) UnhandledPromiseRejectionWarning: Error: Location does not exist!
    at StorageService.getLocationById (C:\Users\me\AppData\Roaming\npm\node_modules\@motionwerk\sharecharge-core-client\node_modules\@motionwerk\sharecharge-lib\dist\services\storageService
.js:30:19)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:18228) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a pro
mise which was not handled with .catch(). (rejection id: 1)
(node:18228) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-
zero exit code.

but there's anything returned...so the cpo backend request keeps waiting for a status code until it timesout

expected behavior:

status code: 404 Not Found error message: "location does not exist", as json, plain or whatever.

adamstaveley commented 6 years ago

should be fixed in 0.7.8

adamstaveley commented 6 years ago

status: 400 error message: 'Unable to find location with that ID'