Bolt-js: Possibly broken app.error

Created on 18 Aug 2019  路  3Comments  路  Source: slackapi/bolt-js

Description

I'm having difficulties with using custom error handlers. Maybe I didn't understand the documentation right. Please take a look at the code snippets below.

This is my setup:

app.message("error", async () => {
  throw new Error("Error 1");
});

app.message("with next", ({ next }) => {
  next(new Error("Error"));
});

app.error(error => {
  console.log("Inside error handler:");
  console.log("Custom error handler", error);
});

None of these messages passes the execution flow to the error handler. What I'm doing wrong?

I suspect that customizing this.on('error', ...) in ExpressReceiver may help to get desirable results (customizable error handler), but why do we need app.error(...) then?

What type of issue is this? (place an x in one of the [ ])

  • [ ] bug
  • [ ] enhancement (feature request)
  • [x] question
  • [ ] documentation related
  • [ ] testing related
  • [ ] discussion

Requirements (place an x in each of the [ ])

  • [x] I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • [x] I've read and agree to the Code of Conduct.
  • [x] I've searched for any related issues and avoided creating a duplicate issue.

Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

Reproducible in:

package version: 1.2.0

node version: 12.6.0

OS version(s): macOS Mojave 10.14.5

Steps to reproduce:

  1. Launch Bolt boilerplate.
  2. Copy the code from the description section of this message.
  3. Trigger both messages.
  4. See that console.logs, placed in the custom error handler are not called.

Expected result:

I'm expecting app.error to catch all unhandled errors and errors from next() function. (I could be wrong about some details regarding error handling in Bolt).

Actual result:

It's impossible to get into the handler which you passed into app.error(...).

Attachments:

Some black magic

bug v1

Most helpful comment

@stevengill @aoberoi My understanding is that this issue has been resolved by v2 release. Can we close this issue now?

All 3 comments

@stevengill @aoberoi My understanding is that this issue has been resolved by v2 release. Can we close this issue now?

@seratch I believe you are right. @aoberoi do you agree?

I agree! I just created a label for v1 and applied it to this issue so it鈥檚 easier to see that it was a bug but only applies to that version series.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dschinkel picture dschinkel  路  4Comments

st3fan picture st3fan  路  3Comments

dschinkel picture dschinkel  路  4Comments

simonsayscode picture simonsayscode  路  3Comments

kmartin-215 picture kmartin-215  路  5Comments