Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibly broken app.error #239

Closed
4 of 9 tasks
TK95 opened this issue Aug 18, 2019 · 3 comments
Closed
4 of 9 tasks

Possibly broken app.error #239

TK95 opened this issue Aug 18, 2019 · 3 comments
Labels
bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented

Comments

@TK95
Copy link
Contributor

TK95 commented Aug 18, 2019

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)
  • question
  • documentation related
  • testing related
  • discussion

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

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • 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

@shaydewael shaydewael added the bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented label Oct 1, 2019
@seratch
Copy link
Member

seratch commented Jun 8, 2020

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

@stevengill
Copy link
Member

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

@aoberoi aoberoi added the v1 label Jun 9, 2020
@aoberoi
Copy link
Contributor

aoberoi commented Jun 9, 2020

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

@aoberoi aoberoi closed this as completed Jun 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented
Projects
None yet
Development

No branches or pull requests

5 participants