1

タイムアウト時に接続タイムアウトを使用すると、次のように表示されます

[2015-07-31 11:46:18.983] [ERROR] console - ServiceUnavailableError:
Response timeout
      at IncomingMessage. (/opt/data/nlb-server-dev/node_modules/connect-timeout/index.js:69:8)
      at IncomingMessage.EventEmitter.emit (events.js:95:17)
      at null._onTimeout (/opt/data/nlb-server-dev/node_modules/connect-timeout/index.js:41:11)
    at Timer.listOnTimeout as ontimeoutenter
[2015-07-31 11:46:18.990] [ERROR] exception-log - Server web-server-1: Caught
exception: Error: Can't set headers after they are sent. stack: Error:
Can't set headers after they are sent.   at
ServerResponse.OutgoingMessage.setHeader (http.js:691:11)    at
ServerResponse.res.set.res.header
(/opt/data/nlbserverdev/node_modules/express/lib/response.js:561:10)  
at ServerResponse.res.send
(/opt/data/nlbserverdev/node_modules/express/lib/response.js:133:12)
at ServerResponse.res.json
(/opt/data/nlb-server-dev/node_modules/express/li
b/response.js:210:15)at ServerResponse.res.send
(/opt/data/nlb-server-dev/node_modules/express/lib/response.js:121:21)
at /opt/data/nlb-server-dev/app/services/web/adminHandler.js:110:9 at
Object.utils.invokeCallback
(/opt/data/nlb-server-dev/app/util/utils.js:9:8) at
/opt/data/nlb-server-dev/app/dao/baseDao.js:48:13 at Query._callback
(/opt/data/nlb-server-dev/app/dao/mysql/mysql.js:55:9) at
Query.Sequence.end
(/opt/data/nlb-server-dev/node_modules/mysql/lib/proto
col/sequences/Sequence.js:78:24)

以下のように扱っていますが、うまくいきません

function errorFilter(err, req, res, next){
  logger.warn(err.stack);
  errcode = err.statusCode || 500;
  msg = err.message || 'server error!';
  res.send(errcode, msg);
}

ミッドワイヤーが見えますが、それを処理する方法がわかりません。私を助けてください。

4

1 に答える 1