mirror of
https://github.com/fullstack-cash/bch-api.git
synced 2026-09-22 01:02:05 -07:00
fix(error handling): Hanling 429 rate limit error better with hyrateUtxos()
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user