Skip to content

fix(cli/fmt_errors): don't panic on source line formatting errors #12449

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

Merged
merged 1 commit into from
Oct 18, 2021

Conversation

nayeemrmn
Copy link
Contributor

Fixes #10886. Returns empty values in case of errors, source lines are non-essential anyway. These errors can happen e.g. when source files change at runtime. A warning is also printed to help us track when it happens in unexpected cases besides this.

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

I wouldn't say this PR fixes #10886 but it's a good work around to stop panics.

@nayeemrmn
Copy link
Contributor Author

nayeemrmn commented Oct 15, 2021

I wouldn't say this PR fixes #10886 but it's a good work around to stop panics.

Source lines aren't essential, most users encountering this would just like it not to panic. We should open separate issues for known and fixable cases where the source line errors like Deno.core.evalContext(). There is no other working repro in that thread and it's not searchable once the panic is fixed.

@nayeemrmn nayeemrmn force-pushed the source-line-format-no-panic branch from 53269ca to 234ad3b Compare October 15, 2021 14:12
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

LGTM, thank you Nayeem

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

Actually could you add an integration test that calls Deno.core.evalContext with a "wrapped" source like in #10886 (comment) ?

@nayeemrmn nayeemrmn force-pushed the source-line-format-no-panic branch from 234ad3b to 59f8cc1 Compare October 17, 2021 16:04
@nayeemrmn nayeemrmn requested a review from bartlomieju October 17, 2021 17:18
@bartlomieju bartlomieju merged commit 5a48d41 into denoland:main Oct 18, 2021
@nayeemrmn nayeemrmn deleted the source-line-format-no-panic branch October 18, 2021 17:16
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.

panic on unwrap() of 'None' value@ cli/fmt_errors.rs
2 participants