From f077c337ec30b7a51eef09a9282ae9c547573414 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Thu, 11 Jun 2020 10:54:26 +0100 Subject: [PATCH] send 503 unavailable response on EPIPE --- app.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app.js b/app.js index 319799a..b22e0a0 100644 --- a/app.js +++ b/app.js @@ -230,6 +230,9 @@ app.use(function(error, req, res, next) { if (error instanceof Errors.NotFoundError) { logger.warn({ err: error, url: req.url }, 'not found error') return res.sendStatus(404) + } else if (error.code === 'EPIPE') { + // inspect container returns EPIPE when shutting down + return res.sendStatus(503) // send 503 Unavailable response } else { logger.error({ err: error, url: req.url }, 'server error') return res.sendStatus((error != null ? error.statusCode : undefined) || 500)