Commit cf0671c
authored
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()`.1 parent 5e4f4e1 commit cf0671c
File tree
3 files changed
+10
-3
lines changed- build_web_compilers
- lib/src
3 files changed
+10
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
1 | 5 | | |
2 | 6 | | |
3 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
103 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
104 | 107 | | |
105 | 108 | | |
106 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
0 commit comments