Skip to content

Commit

Permalink
Merge pull request #362 from bitfinexcom/staging
Browse files Browse the repository at this point in the history
Release version to master
  • Loading branch information
prdn authored Apr 3, 2024
2 parents 7ac0f68 + 4d3757b commit e8b819d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bfx-report",
"version": "4.10.0",
"version": "4.10.1",
"description": "Reporting tool",
"main": "worker.js",
"license": "Apache-2.0",
Expand Down
13 changes: 12 additions & 1 deletion workers/loc.api/helpers/get-data-from-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ module.exports = (
let countNetError = 0
let countRateLimitError = 0
let countNonceSmallError = 0
let countUnexpectedError = 0
let res = null

while (true) {
Expand Down Expand Up @@ -157,7 +158,17 @@ module.exports = (
continue
}

throw err
// Handle unexpected BFX API errors
countUnexpectedError += 1

if (countUnexpectedError > 3) {
throw err
}
if (_isInterrupted(_interrupter)) {
return { isInterrupted: true }
}

await _delay(10000, _interrupter)
}
}

Expand Down
15 changes: 9 additions & 6 deletions workers/loc.api/responder/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ const _getErrorWithMetadataForNonBaseError = (args, err) => {
return err
}

const _getErrorMetadata = (args, err) => {
const _getErrorMetadata = (args, err, name) => {
const errWithMetadata = _getErrorWithMetadataForNonBaseError(args, err)
_addStatusMessageToErrorMessage(errWithMetadata)
const {
Expand Down Expand Up @@ -178,8 +178,10 @@ const _getErrorMetadata = (args, err) => {
data: extendedData
}
)
const serializedError = _prepareErrorData(error, name)
Object.assign(error, { serializedError })

return { code, message, data, error }
return { code, message, data, error, serializedError }
}

const _logError = (loggerArgs, err) => {
Expand All @@ -195,21 +197,22 @@ const _logError = (loggerArgs, err) => {
)
const {
code,
error
} = _getErrorMetadata(args, err)
error,
serializedError
} = _getErrorMetadata(args, err, name)

_emitEventByWs(loggerArgs, error)

if (
code !== 500 ||
shouldNotBeLoggedToStdErrorStream
) {
logger.debug(_prepareErrorData(error, name))
logger.debug(serializedError)

return
}

logger.error(_prepareErrorData(error, name))
logger.error(serializedError)
}

const _emitEventByWs = (emitterArgs, error) => {
Expand Down

0 comments on commit e8b819d

Please sign in to comment.