-
Notifications
You must be signed in to change notification settings - Fork 298
JSON.parse error reporting: with invalid json:
in the error string
#1001
Conversation
Better error reporting in case of `json.parse` failures
invalid json: data
in the errorinvalid json:
in the error string
@alanshaw this is only failing on commitlint should be good to merge |
I think @KrishnaPG is going to update this to be even better ;) |
Making the `parseError` function compatible with non-JSON responses from server. - `isJson = true` parameter added that is backwards compatible with existing code Ref: #1000 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there - just some minor tweaks and this'll be good. Would love to see some tests for this!?
`parseError` method should print default error in case data is null or empty ("") Co-Authored-By: Alan Shaw <alan.shaw@protocol.ai>
This makes `parseError` more self-sufficient.
35:1 error Trailing spaces not allowed no-trailing-spaces
This is needed for the callers to know when the error needs a retry (such as 401, 403 etc.
The remaining lint error is about handling the error in callback
By design we are ignoring that error, since we are already inside an error handler (with a valid error response from server). Is there a way to turn this lint error off, for this specific case, so that this can be merged? |
The changes in this PR now enables usage such as:
Earlier this was not possible, since the textual response from gateways was crashing the app. |
@KrishnaPG I've rebased, added tests and changed |
Better error reporting in case of
json.parse
failuresresolves #912
resolves #1000