-
-
Notifications
You must be signed in to change notification settings - Fork 166
Goccy returns different error messages on unmarshal than standard json #274
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
Comments
The goal is to return the same error type as encoding/json, but since the error content itself does not exist in the specification, it is a difficult problem to make an exact match. (If you are writing a test that depends on error messages, it may not work with |
So one could test if the error is if _, ok := err.(*json.SyntaxError); ok {
// syntax error
} Thought I tend to agree that a module that is advertized as drop-in replacement should also match the error strings, or at least include a notice in documentation that error strings may not exactly match. |
The spec range issue is difficult, but I don't think it's generally important that the error strings match exactly. ( because Go has a way to compare with Also, If you know a drop-in replacement library that mentions error strings, please let me know |
Yeah I guess error messages are kind of a grey zone in regards to APIs and This |
So the reason why this is failing for us is also because jsoniter is actually returning a different error and we're using that error string in our test(!) |
I agree. I think so, too. So I will try to make this error the same as encoding/json as much as possible. In the future as well, I may correct the error message for the purpose of producing a better error message, but I can't guarantee that the same message will be produced at all error points. |
Uh oh!
There was an error while loading. Please reload this page.
Goccy returns different error messages on unmarshal than standard json:
This returns:
This makes goccy json not a complete drop in replacement.
The text was updated successfully, but these errors were encountered: