From 5cb757e7083ed6c19fb9adadb14edd4dd248ec7e Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Tue, 26 Nov 2024 12:53:49 +0200 Subject: [PATCH] Extend data logging by showing public request params --- workers/loc.api/responder/index.js | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/workers/loc.api/responder/index.js b/workers/loc.api/responder/index.js index af64293a..ed4f3786 100644 --- a/workers/loc.api/responder/index.js +++ b/workers/loc.api/responder/index.js @@ -1,5 +1,7 @@ 'use strict' +const { omit } = require('lib-js-util-base') + const AbstractWSEventEmitter = require('../abstract.ws.event.emitter') const { @@ -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 } @@ -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,