Using promises - Logging stack trace in fail handler
I am rather new to nodejs so I will explain in a bit more detail what I am trying to do. I have a webserver. If a request fails I want to log the stack trace of that exception, but deliver a error page and not crash the server. As an example, the function handling the requests: var Q = require('q'); var requestHandler = function () { // Here I get the data etc. that was requested. As this is not important, just a dummy here Q.resolve() // Now I answer the request .then(function (data) { // Dummy Code representing the sending of a response console.log('sending response …'); console.log('oh no!