matrix-org / matrix-org/matrix-bifrost

UnhandledPromiseRejectionWarning due to `throw Error` in async function.

Open
#66 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

T-Defect
Dominant language
TypeScript
Stars
187
Forks
38
PR merge metrics
No merged PRs in 30d

Description

Various Errors being thrown are not caught and are propagating to stderr (maybe stdout, can't quite tell) and being logged outside of logs.

(node:20525) 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(). (rejection id: 141031)
(node:20525) UnhandledPromiseRejectionWarning: Error: Have multiple matrix rooms assigned for chat. Bailing
    at Store.getRoomByRemoteData (/matrix-appservice-purple/build/src/Store.js:83:23)
(node:20525) 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(). (rejection id: 141032)
(node:20525) UnhandledPromiseRejectionWarning: Error: Server returned 408 error
    at parseErrorResponse (/matrix-appservice-purple/node_modules/matrix-js-sdk/lib/http-api.js:854:15)
    at /matrix-appservice-purple/node_modules/matrix-js-sdk/lib/http-api.js:803:27
    at /matrix-appservice-purple/node_modules/matrix-js-sdk/lib/http-api.js:753:17
    at Request._callback (/matrix-appservice-purple/node_modules/matrix-appservice-bridge/lib/components/client-factory.js:75:13)
    at Request.self.callback (/matrix-appservice-purple/node_modules/request/request.js:185:22)
    at Request.emit (events.js:182:13)
    at Request.<anonymous> (/matrix-appservice-purple/node_modules/request/request.js:1161:10)
    at Request.emit (events.js:182:13)
    at IncomingMessage.<anonymous> (/matrix-appservice-purple/node_modules/request/request.js:1083:12)
    at Object.onceWrapper (events.js:273:13)
    at IncomingMessage.emit (events.js:187:15)
    at endReadableNT (_stream_readable.js:1094:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at Store.getRoomByRemoteData in build/src/Store.js and trace the async callers that can produce the reported unhandled rejections. Review how errors from that method and the Matrix client request are propagated; done means the relevant failures are handled through the project's intended logging path without UnhandledPromiseRejectionWarning output.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.