Closed lurr closed 2 years ago
Something is wrong with websocket error handling, this function:
Will fail very ungracefully if the address wasn't found:
[19:03:40] [Error] Uncaught error.
[19:03:40] TypeError: Cannot read property 'address' of null
at Function.Addresses.addressToJSON (/home/lem/Projects/krist/src/addresses.js:148:22)
at Function.AddressesController.addressToJSON (/home/lem/Projects/krist/src/controllers/addresses.js:70:20)
at Array.address (/home/lem/Projects/krist/src/websocket_routes/addresses.js:43:21)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async WebSocket.<anonymous> (/home/lem/Projects/krist/src/websockets.js:186:24)
https://github.com/tmpim/Krist/blob/6bdd0357cfd60d8273411938556a3de30736fe34/src/websockets.js#L186 Is this await in the right place?
thank you for your work on this - i believe most of these edits will have been picked up in the typescript refactor, but if you think of anything i might not have caught please let me know :)
This PR replaces all instances of
Promise
,.catch
, and.then
with their ES6 counterparts ofasync
/await
, where appropriate.