Skip to content

Better error logging on event failure#450

Merged
esezen merged 3 commits into
Constructor-io:masterfrom
jakequade-pc:master
May 27, 2026
Merged

Better error logging on event failure#450
esezen merged 3 commits into
Constructor-io:masterfrom
jakequade-pc:master

Conversation

@jakequade-pc
Copy link
Copy Markdown
Contributor

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
@jakequade-pc
Copy link
Copy Markdown
Contributor 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
Contributor Author

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

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
Comment on lines +150 to +158
var serialized;
try {
serialized = JSON.stringify(er);
} catch (e) {
serialized = undefined;
}
if (typeof serialized !== 'string') {
serialized = Object.prototype.toString.call(er);
}
Copy link
Copy Markdown
Contributor

@esezen esezen left a comment

Choose a reason for hiding this comment

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

LGTM!

@esezen esezen merged commit 9ee9ca8 into Constructor-io:master May 27, 2026
9 of 11 checks passed
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