oceanprotocol/RBAC-Server

Improve error handling

jamiehewitt15 opened this issue · 0 comments

If you send a request to the RBAC server with a did that is not in Aquarius it will respond with the error message below. The current error message is not very clear:

rbac_1             | Request failed with status code 404
rbac_1             | (node:20) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'publicKey' of undefined
rbac_1             |     at Object.<anonymous> (/usr/src/app/dist/controllers/assetController.js:55:25)
rbac_1             |     at step (/usr/src/app/dist/controllers/assetController.js:33:23)
rbac_1             |     at Object.next (/usr/src/app/dist/controllers/assetController.js:14:53)
rbac_1             |     at fulfilled (/usr/src/app/dist/controllers/assetController.js:5:58)
rbac_1             |     at processTicksAndRejections (internal/process/task_queues.js:95:5)
rbac_1             | (node:20) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)

To-do:

  • Improve error handling in src/utils/getDDO.ts