-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
dart analyze
should gracefully handle analysis options formatting errors
#55987
Comments
Should probably catch the error and report it (more) gracefully. Don't know if this should be handled in the (If the YAML parser could be made to recover from errors, it might be possible to give more precise errors too, but that depends on the |
\cc @DanTup Since I think you recently added some handling for when the analysis server crashes. |
I think there are two behaviours here that may be questionable, but I don't know what the desired behaviour is for each (cc @bwilkerson).
|
I agree. I don't think the server should be returning an exception in this case. The general design of the server is to recover from errors as cleanly as possible, notifying the user of the error with enough information that the user can fix the problem. I don't know what the limitations of the Ideally, the
Given that this should only happen as a result of an internal bug that the server couldn't recover from, I think it's reasonable for the command-line tool to print out the message and stack trace, prefixed by a message explaining that this is an internal error and asking the user to report it. |
It seems we already handle generating diagnostics for the case above, the issue is just that the server crashes before it gets there (during setting the roots). There are many places already handling these errors, but not path in the stack trace above. I've started a change at https://dart-review.googlesource.com/c/sdk/+/371861 which:
The result is that I'm not sure if we want to just mash that text on to the end of the error like that though - it's not what was suggested above, but it does mean that it appears in the clients instead of only |
…yaml better + tweak unhandled exception text Fixes the main issues at #55987 Change-Id: I5b86f7c0df4017c02b96e67d8d8d03b71933b318 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371861 Reviewed-by: Sam Rawlins <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Brian Wilkerson <[email protected]>
Some slight changes to what I noted above, with the latest change errors in
|
I have no idea why it got this error:
the flutter master sitll have this issue, how to resolve it? |
@lucasjinreal that looks like a slightly different error - could you file a new issue with a copy of your |
If you run
dart analyze
when youranalysis_options.yaml
has a syntax error, such as the following:Then you receive an error that isn't user friendly and unnecessarily highlights/exposes potentially confusing analyzer internals. The process doesn't fully exit either, needing to be killed.
Tested at 6c6b104
The text was updated successfully, but these errors were encountered: