A HTTP error will cause Node.js to exit (non-gracefully)
See original GitHub issueIf a HTTP error occurs (for whatever reason) during a Mollie API Request, Node.js exits, without a way for the end-user to catch the error, i.e.:
events.js:72
throw er; // Unhandled 'error' event
^
Error: Parse Error
at CleartextStream.socketOnData (http.js:1583:20)
at CleartextStream.read [as _read] (tls.js:507:12)
at CleartextStream.Readable.read (_stream_readable.js:320:10)
at EncryptedStream.write [as _write] (tls.js:366:25)
at doWrite (_stream_writable.js:221:10)
at writeOrBuffer (_stream_writable.js:211:5)
at EncryptedStream.Writable.write (_stream_writable.js:180:11)
at write (_stream_readable.js:583:24)
at flow (_stream_readable.js:592:7)
at Socket.pipeOnReadable (_stream_readable.js:624:5)
This can/should be prevented by adding a request.on(‘error’, function(err) { … }) handler, and calling the end-user callback function with the appropriate feedback, in the rest client:
https://github.com/mollie/mollie-api-node/blob/master/src/lib/mollie/api/client.coffee#L82-92
Issue Analytics
- State:
- Created 9 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Errors | Node.js v19.3.0 Documentation
const cause = new Error('The remote HTTP server responded with a 500 status'); const symptom ... Often a sign that a socket.end() was...
Read more >Make node.js not exit on error - Stack Overflow
404 status codes are for HTTP, this question was about a socket server so while you can handle the error however you want,...
Read more >Let It Crash: Best Practices for Handling Node.js Errors on ...
So as I say in both cases an error event, it's a cause of termination for your Node. js process. Always exit the...
Read more >How to Exit a Process in Node.js: process.exit() Method
Learn how to terminate a Node.js application in the best possible way. We will explain how to do this with the process.exit() function...
Read more >nodejs-api/ errors
Applications running in Node.js will generally experience four categories of errors: Standard JavaScript errors such as {EvalError}, { ...
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
Please use our new
@mollie/api-client
module, which is completely rewritten to ES6 and fully tested.You can find information on how to upgrade in our Migration guide.
#18 is addressing this issue.