res not returned when superagent fails JSON parsing
See original GitHub issueIn the JSON parser:
res.on('end', function(){
try {
fn(null, JSON.parse(res.text));
} catch (err) {
fn(err);
}
});
The res object is not returned on a failed parse - I cannot inspect headers or anything else on the res that might be of interest or can give me a way to handle failed parsing.
Issue Analytics
- State:
- Created 9 years ago
- Comments:12 (3 by maintainers)
Top Results From Across the Web
res not returned when superagent fails JSON parsing #487
This fails for me in 0.21.0. I only get back error object and a null res. Error message is "Parser is unable to...
Read more >Superagent: Error: Parser is unable to parse the response
So to be clear, when uploading a single file, I get a nice JSON response, but when I upload multiple files, the response...
Read more >How to use the superagent.parse function in ... - Snyk
To help you get started, we've selected a few superagent.parse examples, ... if (!text) return done(null, {result: []}); try { done(null, JSON.parse(text)); } ......
Read more >superagent | Yarn - Package Manager
end(…) . Consider not using .end() at all, and migrating to promises by calling .then() instead. In Node, responses with unknown MIME type...
Read more >Error: Parser is unable to parse the response-Reactjs
Coding example for the question Superagent: Error: Parser is unable to parse the response-Reactjs.
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 FreeTop 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
Top GitHub Comments
Unparseable input is now returned as a property of the error.
+1