Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mention JSON format in dart2js args error message (#3414)
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()`.
- Loading branch information