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
Diagnosing "Something is wrong with your metadata at position NaN and line 1" #17
Comments
looks like we just need to update the pattern matching? I can look at this over the weekend probably, happy to accept pull requests as well |
The issue is that
Happy to write a PR on either of these tomorrow or over the weekend but I'm not sure which is better from your perspective. |
The library doesn't look huge maybe that's the best bet. Would be nice to
have reliable parsing. Since you're working on the site I leave the choice
to you.
…On Thu, Nov 1, 2018 at 10:41 PM Will Goldie ***@***.***> wrote:
The issue is that JSON.parse can throw a SyntaxError with an arbitrary
message. Different browsers/environments will have different error
messages. I see a couple of options:
1.
We can try to identify the messages of different browser/runtime
vendors and match against them, and fail gracefully otherwise.
Unfortunately it seems that the useful SyntaxError.prototype.lineNumber
property is not implemented by anyone besides Firefox (according to MDN
<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SyntaxError>
)
2.
We could also use a library for JSON parsing that will reliably emit
error locations. jsonlint <https://github.com/zaach/jsonlint> seems
like a good lightweight option.
Happy to write a PR on either of these tomorrow or over the weekend but
I'm not sure which is better from your perspective.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#17 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAJ1b9dqh75h37qL7fH_ppdQ5Oyni-ecks5uq9sEgaJpZM4YFsSQ>
.
|
interactive-shader-format-js/src/MetadataExtractor.js
Line 18 in 7f84e3a
This function doesn't appear to be portable - the error message that JSON.parse spits out isn't standardized.
In Chromium I get
"Unexpected token a in JSON at position 175"
which results in the correct behavior.In Firefox I get
"JSON.parse: expected double-quoted property name at line 37 column 30 of the JSON data"
. Here the attempt to extract the position fails.The text was updated successfully, but these errors were encountered: