mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
meteor run: Handle errors in the websocket proxy by closing socket instead of
throwing
This commit is contained in:
@@ -181,14 +181,15 @@ var startProxy = function (outerPort, innerPort, callback) {
|
||||
// don't crash if the app doesn't respond. instead return an error
|
||||
// immediately. This shouldn't happen much since we try to not send requests
|
||||
// if the app is down.
|
||||
// XXX should we also handle http-proxy:outgoing:ws:error, for a failed
|
||||
// websocket?
|
||||
proxy.ee.on('http-proxy:outgoing:web:error', function (err, req, res) {
|
||||
res.writeHead(503, {
|
||||
'Content-Type': 'text/plain'
|
||||
});
|
||||
res.end('Unexpected error.');
|
||||
});
|
||||
proxy.ee.on('http-proxy:outgoing:ws:error', function (err, req, socket) {
|
||||
socket.close();
|
||||
});
|
||||
|
||||
server.listen(outerPort, callback);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user