add more debugging logs
This commit is contained in:
+10
-2
@@ -55,7 +55,7 @@ class Client extends EventEmitter {
|
||||
this.emit('close');
|
||||
}
|
||||
|
||||
handleRequest(req, res) {
|
||||
handleRequest(req, res, retry = true) {
|
||||
this.debug('> %s', req.url);
|
||||
const opt = {
|
||||
path: req.url,
|
||||
@@ -74,6 +74,7 @@ class Client extends EventEmitter {
|
||||
pump(clientRes, res, (err) => {
|
||||
if (err) {
|
||||
this.debug('> PIPE ERROR, %s', err);
|
||||
this.debug(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -83,14 +84,21 @@ class Client extends EventEmitter {
|
||||
// if we have already sent headers?
|
||||
clientReq.once('error', (err) => {
|
||||
// TODO(roman): if headers not sent - respond with gateway unavailable
|
||||
this.debug('ERROR < %s', req.url);
|
||||
this.debug(' < ERROR %s', req.url);
|
||||
this.debug(err);
|
||||
this.debug(JSON.stringify( err ));
|
||||
|
||||
if (retry) {
|
||||
this.debug('< RETRY');
|
||||
this.handleRequest( req, res, false);
|
||||
}
|
||||
});
|
||||
|
||||
// using pump is deliberate - see the pump docs for why
|
||||
pump(req, clientReq, (err) => {
|
||||
if (err) {
|
||||
this.debug('< PIPE ERROR, %s', err);
|
||||
this.debug(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user