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

Retain backtrace for TypeErrors in value change callback #584

Merged
merged 1 commit into from Sep 15, 2022

Conversation

elliotcm
Copy link
Contributor

This code was originally added to provide better error messaging for TypeErrors when assigning values.

Unfortunately throwing a new error object causes us to lose the context (including stacktrace) of the original error, making it harder to locate the source.

Changing the message and rethrowing the original error retain that information.

Before

Screenshot 2022-09-11 at 22 01 34

After

Screenshot 2022-09-11 at 22 11 27

Thanks to @marcoroth for help discussing this issue.

This code was originally added to provide better error messaging
for TypeErrors when assigning values.

Unfortunately throwing a new error object causes us to lose
the context (including stacktrace) of the original error,
making it harder to locate the source.

Changing the message and rethrowing the original error
retain that information.
Copy link
Member

@marcoroth marcoroth left a comment

Choose a reason for hiding this comment

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

Thank you, @elliotcm!

@marcoroth marcoroth merged commit 11e4c16 into hotwired:main Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants