long-stack-traces | Long stacktraces for V8 | Navigation library
kandi X-RAY | long-stack-traces Summary
kandi X-RAY | long-stack-traces Summary
Long stacktraces for V8 implemented in user-land JavaScript. Supports Chrome/Chromium and Node.js.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of long-stack-traces
long-stack-traces Key Features
long-stack-traces Examples and Code Snippets
Community Discussions
Trending Discussions on long-stack-traces
QUESTION
I'm using Restify and somewhere in the Restify library, an exception is being thrown due to some bad inputs on the user side. I have some simplified code below that recreates the issue. The problem in the example below is in an asynchronous function that tries to execute doesntexist.nofunction. What happens is that an exception is thrown then caught in the "server.on('uncaughtException.." function, but the "err" object is actually an "IncomingMessage" type, not an "Error" type. I have a few questions about this.
...1) Should exceptions thrown always be of type "Error" and if not, is this a bug in Restify?
2) Is it a best practice for libraries that take in a callback parameter to also set an "err" parameter if there's an error, and let the client handle it in the callback as opposed to the library throwing an exception?
ANSWER
Answered 2017-Feb-08 at 00:43- Node-style callback functions should have a signature with
err
as the first argument. This is not in any spec, per se, but is a community norm.
Your code is like this:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install long-stack-traces
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page