Skip to content

Commit

Permalink
Extend data logging by showing public request params
Browse files Browse the repository at this point in the history
  • Loading branch information
ZIMkaRU committed Nov 26, 2024
1 parent 19addc8 commit 5cb757e
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 5cb757e

Please sign in to comment.