Skip to content

Commit

Permalink
Merge pull request #414 from ZIMkaRU/feature/extend-data-logging-by-s…
Browse files Browse the repository at this point in the history
…howing-public-request-params

Extend data logging by showing public request params
  • Loading branch information
ezewer authored Nov 27, 2024
2 parents 5fa8637 + 5cb757e commit d2b991b
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions workers/loc.api/responder/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict'

const { omit } = require('lib-js-util-base')

const AbstractWSEventEmitter = require('../abstract.ws.event.emitter')

const {
Expand Down Expand Up @@ -130,7 +132,6 @@ const _getErrorWithMetadataForNonBaseError = (args, err) => {
err.message = err.message.replace(']', `,"${symbol}"]`)
err.statusCode = 500
err.statusMessage = `Invalid symbol error, '${symbol}' is not supported`
err.data = [{ symbol }]

return err
}
Expand Down Expand Up @@ -163,12 +164,21 @@ const _getErrorMetadata = (args, err, name) => {
const message = bfxApiErrorMessage
? `${statusMessage}: BFX API Error${bfxApiStatusText}${bfxApiRawBodyResponse}`
: statusMessage
const extendedData = bfxApiErrorMessage
? {
bfxApiErrorMessage,
...data
}
: data
const pubRequestParams = omit(
args?.params ?? null,
[
'id',
'subAccountApiKeys',
'subAccountPassword',
'addingSubUsers',
'removingSubUsersByEmails'
]
)
const extendedData = {
pubRequestParams,
bfxApiErrorMessage,
...data
}

const error = Object.assign(
errWithMetadata,
Expand Down

0 comments on commit d2b991b

Please sign in to comment.