From d76c663f25f531c7e7436885874b483859f8fe13 Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Thu, 1 Apr 2021 09:46:33 -0700 Subject: [PATCH] fix(error handling): Hanling 429 rate limit error better with hyrateUtxos() --- src/util/route-utils.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/util/route-utils.js b/src/util/route-utils.js index ba32ca1..ce5b60f 100644 --- a/src/util/route-utils.js +++ b/src/util/route-utils.js @@ -154,16 +154,23 @@ class RouteUtils { } } - // Handle 429 errors thrown by nginx + // Handle 429 errors if (err.error) { console.log('decodeError: err: ', err) + // Error thrown by nginx (usually the SLPDB load balancer.) if (err.error.includes('429 Too Many Requests')) { const internalMsg = '429 error thrown by nginx caught by route-utils.js/decodeError()' console.error(internalMsg) wlogger.error(internalMsg) + return { + msg: '429 Too Many Requests', + status: 429 + } + } else if (err.error.includes('Too many requests')) { + // Error is being thrown by bch-api rate limit middleware. return { msg: '429 Too Many Requests', status: 429