mirror of
https://github.com/fullstack-cash/bch-api.git
synced 2026-09-21 16:52:04 -07:00
Merge pull request #126 from Permissionless-Software-Foundation/ct-unstable
fix(error handling): Hanling 429 rate limit error better with hyrateU…
This commit is contained in:
@@ -154,16 +154,23 @@ class RouteUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle 429 errors thrown by nginx
|
// Handle 429 errors
|
||||||
if (err.error) {
|
if (err.error) {
|
||||||
console.log('decodeError: err: ', err)
|
console.log('decodeError: err: ', err)
|
||||||
|
|
||||||
|
// Error thrown by nginx (usually the SLPDB load balancer.)
|
||||||
if (err.error.includes('429 Too Many Requests')) {
|
if (err.error.includes('429 Too Many Requests')) {
|
||||||
const internalMsg =
|
const internalMsg =
|
||||||
'429 error thrown by nginx caught by route-utils.js/decodeError()'
|
'429 error thrown by nginx caught by route-utils.js/decodeError()'
|
||||||
console.error(internalMsg)
|
console.error(internalMsg)
|
||||||
wlogger.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 {
|
return {
|
||||||
msg: '429 Too Many Requests',
|
msg: '429 Too Many Requests',
|
||||||
status: 429
|
status: 429
|
||||||
|
|||||||
Reference in New Issue
Block a user