Skip to content

Unhandled rejection on 403 #12

@awlayton

Description

@awlayton

When oada-cache receives 403 sometimes the rejection is not passed up to the user of the library so there is no way to handle the rejection,

(node:3700) UnhandledPromiseRejectionWarning: Error: Request failed with status
code 403
    at WebSocket.socket.onmessage (/mnt/c/Users/alex/source/oada-srvc-docker/ser
vices-available/foo/node_modules/@oada/oada-cache/build/websocket.js:69:23)
    at WebSocket.onMessage (/mnt/c/Users/alex/source/oada-srvc-docker/services-a
vailable/foo/node_modules/ws/lib/event-target.js:120:16)
    at WebSocket.emit (events.js:321:20)
    at Receiver.receiverOnMessage (/mnt/c/Users/alex/source/oada-srvc-docker/ser
vices-available/foo/node_modules/ws/lib/websocket.js:720:20)
    at Receiver.emit (events.js:321:20)
    at Receiver.dataMessage (/mnt/c/Users/alex/source/oada-srvc-docker/services-
available/foo/node_modules/ws/lib/receiver.js:414:14)
    at Receiver.getData (/mnt/c/Users/alex/source/oada-srvc-docker/services-avai
lable/foo/node_modules/ws/lib/receiver.js:346:17)
    at Receiver.startLoop (/mnt/c/Users/alex/source/oada-srvc-docker/services-av
ailable/foo/node_modules/ws/lib/receiver.js:133:22)
    at Receiver._write (/mnt/c/Users/alex/source/oada-srvc-docker/services-avail
able/foo/node_modules/ws/lib/receiver.js:69:10)
    at doWrite (_stream_writable.js:454:12)
    at writeOrBuffer (_stream_writable.js:436:5)
    at Receiver.Writable.write (_stream_writable.js:327:11)
    at TLSSocket.socketOnData (/mnt/c/Users/alex/source/oada-srvc-docker/service
s-available/foo/node_modules/ws/lib/websocket.js:795:35)
    at TLSSocket.emit (events.js:321:20)
    at addChunk (_stream_readable.js:297:12)
    at readableAddChunk (_stream_readable.js:273:9)
    at TLSSocket.Readable.push (_stream_readable.js:214:10)
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:186:23)
(node:3700) 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 termina
te the node process on unhandled promise rejection, use the CLI flag `--unhandle
d-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejectio
ns_mode). (rejection id: 2)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions