Monday, 5 June 2017

Express returning error 500, no stack trace

I'm sending request to my express based server, and getting 500 but without a stack trace. Other errors printed directly to console.

Response: PUT /test 500 57207.231 ms - 1201

  1. I tried to catch those errors in error handling, but still no luck.

    app.use(function(err, req, res, next) {
    
      _logger.log('500 ERROR', err.message);
    
      res.status(err.status || 500);
      res.render('error', {
        message: err.message,
        error: {}
      });
    });
    
    
  2. I've set requestTimeut to 0 in the relevant request.

    router.put('/', middlewares.isAuthenticated, function(req, res, next) {
       ....
       req.setTimeout(0);
       ....
    });
    
    

How can i pinpoint the error?



via jvrnt

No comments:

Post a Comment