Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend data logging by showing public request params #414

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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