Commit 9757213
committed
fix: Ensure error location by custom parsing
The native JSON.parse does not always provide the error location
at the end of the error message. These two invalid inputs either
include or not include the error location and it is different
with Node.js 18 and Node.js 20:
{ "foo": \"baz }
{ "foo": baz }
If the locatoin is missing, let us parse the input once more
by the custom parser, which always provides the error location.1 parent 30f611a commit 9757213
1 file changed
+5
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
159 | 163 | | |
160 | 164 | | |
0 commit comments