Tuesday, 2 May 2017

express-ws is silencing errors

I am use express and express-ws in a node application. However, express-ws seems to be silencing errors making it very difficult to debug my code.

I've reduced my code down to just the following which still reproduces the problem:

// configure express
var express = require('express');
var app = express();
var expressWs = require('express-ws')(app);

// set up routes

app.get('/', function(req, res) {
    console.log("GET");
    nonExistingFunction();
});

app.ws('/', function(ws, req){    
    console.log("WS");
    nonExistingFunction();
});

// start service
app.listen(90);

When I GET from a browser, the console shows the 'GET' log message followed by the traceback. When I connect via Websocket, the console just shows the 'WS' log message - no traceback.

Does express-ws silence errors by default? Is there a way to switch it off?



via nnxen

No comments:

Post a Comment