Skip to content

Better error logging on event failure#450

Open
jakequade-pc wants to merge 3 commits into
Constructor-io:masterfrom
jakequade-pc:master
Open

Better error logging on event failure#450
jakequade-pc wants to merge 3 commits into
Constructor-io:masterfrom
jakequade-pc:master

Conversation

@jakequade-pc
Copy link
Copy Markdown

We're getting Unhandled error. (undefined), which isn't super helpful. This PR retains the current logic (er.message is used when it exists), otherwise stringify the error and send it back as-is.

Copilot AI review requested due to automatic review settings May 6, 2026 04:44
@jakequade-pc jakequade-pc requested a review from a team as a code owner May 6, 2026 04:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to improve the usefulness of unhandled event error messages in EventEmitter.emit(...) by including additional context when the thrown value doesn’t have an error.message.

Changes:

  • Updated the fallback “Unhandled error” message construction to include serialized error context when .message is unavailable.
  • (Formatting-only) No functional change in the closing brace at EOF.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/utils/events.js Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread src/utils/events.js Outdated
}
// At least give some kind of context to the user
var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));
var err = new Error('Unhandled error.' + (er && er.message ? ' (' + er.message + ')' : JSON.stringify(er)));
@jakequade-pc
Copy link
Copy Markdown
Author

@vladconstructor this is a minor one but would help with some errors we're getting where the message is just undefined.

Comment thread src/utils/events.js Outdated
extended serialisation

Co-authored-by: Enes Kutay SEZEN <eneskutaysezen@gmail.com>
@jakequade-pc
Copy link
Copy Markdown
Author

Cool - makes sense. Thanks for your time @esezen 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants