Skip to content

More elaborate error message for users on reanalyze json error #544

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 2 commits into from
Aug 3, 2022

Conversation

zth
Copy link
Collaborator

@zth zth commented Aug 2, 2022

Follow up for: #537

This logs a more elaborate error for the user, including instructions on how to report the error, when reanalyze json is invalid for some reason.

image

image

…g an instruction on what to do with the error
@zth zth requested a review from cristianoc August 2, 2022 17:25
Comment on lines +73 to +77
let outputChannel = window.createOutputChannel(
"ReScript Language Server",
"rescript"
);

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Creating and passing around an explicit output channel lets us have a good place to log things to, that's also easy to reveal programatically.

Copy link
Collaborator

@cristianoc cristianoc left a comment

Choose a reason for hiding this comment

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

This is great!
In addition, I was wondering whether we could issue a reproducible command. As that's required to produce the JSON in the first place.
That I guess would amount to pasting the command used to run the analysis.

Or even a few words on how to report an issue (which requires a repro project together wit the command).

@zth
Copy link
Collaborator Author

zth commented Aug 3, 2022

image

What about this?

EDIT: Actually, with the reproduction command, we don't need to print the failed JSON to the log, just how to reproduce. Let me change that.

What about this instead:
image

@cristianoc
Copy link
Collaborator

This is great!
Ready to merge?

@zth zth merged commit 3b4c0a8 into master Aug 3, 2022
@zth
Copy link
Collaborator Author

zth commented Aug 3, 2022

Yup!

@zth zth deleted the log-reanalyze-json-errors branch August 3, 2022 17:58
@Minnozz
Copy link
Contributor

Minnozz commented Aug 4, 2022

The error itself when trying to parse the JSON is no longer logged, is that intentional?

@zth
Copy link
Collaborator Author

zth commented Aug 4, 2022

Yes, it's intentional. But it can be added again if it's considered helpful. I didn't think a random json error message would help anyone though as it's the accompanying json one is interested in to fix the issue, and the error itself can be reproduced by trying to parse the faulty json.

@cristianoc
Copy link
Collaborator

How about an analogous one when there's an issue parsing the compiler log, as it's much more likely to happen and/or regress.

@zth
Copy link
Collaborator Author

zth commented Aug 17, 2022

@cristianoc yes, this is a good idea. I can do that once I'm out of the woods on the current things I'm working on. Adding a new ticket to make sure it isn't lost.

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