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

Mention JSON format in dart2js args error message #3414

Merged
merged 1 commit into from Dec 3, 2022

Commits on Nov 29, 2022

  1. Mention JSON format in dart2js args error message

    For `--define` arguments build_runner will attempt a JSON parse, and
    treat anything with a format error as a `String`.
    Parsing as JSON allows for structured content, similar to what can be
    added in `build.yaml`. Silently falling back to the input as a string
    avoids requiring extra quotes for the majority of simple options.
    
    When the JSON decode fails unexpectedly, the error message can be
    confusing and does not point to the problem. It's not easy to
    distinguish between a `build.yaml` with a String value (that never would
    be parsed as JSON) or command line argument, so we cannot tell for sure
    if JSON formatting is the problem. The best we can do is point out that
    it may have failed to parse.
    
    Remove the name of the argument from the message, it is already present
    in the `ArgumentError.toString()`.
    natebosch committed Nov 29, 2022
    Copy the full SHA
    89b59fd View commit details
    Browse the repository at this point in the history