From b6b8d54cdacd700cae23d54480f43cb84704ab1c Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Mon, 25 Nov 2019 20:57:02 -0800 Subject: [PATCH] Handling EAI_AGAIN error --- src/routes/v3/route-utils.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/routes/v3/route-utils.js b/src/routes/v3/route-utils.js index d49b29d..38652fc 100644 --- a/src/routes/v3/route-utils.js +++ b/src/routes/v3/route-utils.js @@ -131,6 +131,15 @@ function decodeError(err) { } } + // Different kind of network error + if (err.message && err.message.indexOf("EAI_AGAIN") > -1) { + return { + msg: + "Network error: Could not communicate with full node or other external service.", + status: 503 + } + } + return { msg: false, status: 500 } } catch (err) { wlogger.error(`unhandled error in route-utils.js/decodeError(): `, err)