Ability to access the json response in case of error
See original GitHub issueThe documentation mentions that error handling is done in the catch
handler of the promise. This handler receives an instance of an error object. But there’s no way to access the json that came in the error response body. At least there’s no documented way that I could find, and I tried checking if the catch
handler received a second argument, or if the error object contains this somehow, but I couldn’t find it.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How to Fix the Invalid JSON Response Error in WordPress
The response is not a valid JSON response," it will typically appear when you're working on content in the WordPress Block Editor. In...
Read more >Error while parsing JSON Response in REST API Post call
I switched to returning a JSON String and then Deserialize the JSON String, it still raises an error "Failed to parse response of...
Read more >Returning error JSON response in case of CustomException ...
As of now i am getting the proper json response as per bean EmployeeResponseData if the input empId is a match. But i...
Read more >How to Fix “The Response Is Not a Valid JSON ... - iThemes
This guide explains how the Gutenberg editor works with REST API and how to fix "The response is not a valid JSON response"...
Read more >Python Parse JSON response using requests library - PYnative
You can get a 204 error In case the JSON decoding fails. The response.json() raises an exception in the following scenario.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sure is!
This is the only difference between
request
andraw
, all the internals are the same. Sorry that the docs aren’t clear that it’s a method as well.If you’re good with using
raw
then I’m going to close this. LMK if that doesn’t fix things for you.I read about the
.raw
method in the README, did not know about it before. Is this accessible as a method of the service object? Because I have no objection to use it like this:Does it still preserve any headers or customizations I made on the ajax service (namespace, headers, etc.)? If that’s so, then this case is mute. The thing is, in the README it does not appear this is the case. They mention importing it as some lower level API that does not use the service object at all, but rather the service object uses it.