Skip to content

Commit

Permalink
fix: error log
Browse files Browse the repository at this point in the history
  • Loading branch information
kalinkrustev committed May 8, 2024
1 parent c59055e commit a2bbb53
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 51 deletions.
77 changes: 34 additions & 43 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
"pre-commit": "1.2.2",
"proxyquire": "2.1.3",
"replace": "^1.2.2",
"sinon": "17.0.1",
"sinon": "17.0.2",
"standard": "17.1.0",
"standard-version": "9.5.0",
"swagmock": "1.0.0"
Expand Down
12 changes: 6 additions & 6 deletions src/handlers/QuotingHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class QuotingHandler {
await model.handleQuoteRequest(headers, payload, span, this.cache)
this.logger.debug('handlePostQuotes is done')
} catch (err) {
this.logger.error(`error in handlePostQuotes: ${err?.stack}`)
this.logger.error(`error in handlePostQuotes partition:${requestData.partition}, offset:${requestData.offset}: ${err?.stack}`)
const fspiopError = reformatFSPIOPError(err)
const fspiopSource = headers[FSPIOP.SOURCE]
await model.handleException(fspiopSource, payload.quoteId, fspiopError, headers, span)
Expand All @@ -90,7 +90,7 @@ class QuotingHandler {
: await model.handleQuoteUpdate(headers, quoteId, payload, span)
this.logger.isDebugEnabled && this.logger.debug(`handlePutQuotes is done: ${JSON.stringify(result)}`)
} catch (err) {
this.logger.error(`error in handlePutQuotes: ${err?.stack}`)
this.logger.error(`error in handlePutQuotes partition:${requestData.partition}, offset:${requestData.offset}: ${err?.stack}`)
const fspiopSource = headers[FSPIOP.SOURCE]
await model.handleException(fspiopSource, quoteId, err, headers, span)
}
Expand All @@ -108,7 +108,7 @@ class QuotingHandler {
await model.handleQuoteGet(headers, quoteId, span)
this.logger.debug('handleGetQuotes is done')
} catch (err) {
this.logger.error(`error in handleGetQuotes: ${err?.stack}`)
this.logger.error(`error in handleGetQuotes partition:${requestData.partition}, offset:${requestData.offset}: ${err?.stack}`)
const fspiopSource = headers[FSPIOP.SOURCE]
await model.handleException(fspiopSource, quoteId, err, headers, span)
}
Expand All @@ -126,7 +126,7 @@ class QuotingHandler {
await model.handleBulkQuoteRequest(headers, payload, span)
this.logger.debug('handlePostBulkQuotes is done')
} catch (err) {
this.logger.error(`error in handlePostBulkQuotes: ${err?.stack}`)
this.logger.error(`error in handlePostBulkQuotes partition:${requestData.partition}, offset:${requestData.offset}: ${err?.stack}`)
const fspiopError = reformatFSPIOPError(err)
const fspiopSource = headers[FSPIOP.SOURCE]
await model.handleException(fspiopSource, payload.bulkQuoteId, fspiopError, headers, span)
Expand All @@ -148,7 +148,7 @@ class QuotingHandler {
: await model.handleBulkQuoteUpdate(headers, bulkQuoteId, payload, span)
this.logger.isDebugEnabled && this.logger.debug(`handlePutBulkQuotes is done: ${JSON.stringify(result)}`)
} catch (err) {
this.logger.error(`error in handlePutBulkQuotes: ${err?.stack}`)
this.logger.error(`error in handlePutBulkQuotes partition:${requestData.partition}, offset:${requestData.offset}: ${err?.stack}`)
const fspiopSource = headers[FSPIOP.SOURCE]
await model.handleException(fspiopSource, bulkQuoteId, err, headers, span)
}
Expand All @@ -166,7 +166,7 @@ class QuotingHandler {
await model.handleBulkQuoteGet(headers, bulkQuoteId, span)
this.logger.debug('handleGetBulkQuotes is done')
} catch (err) {
this.logger.error(`error in handleGetBulkQuotes: ${err?.stack}`)
this.logger.error(`error in handleGetBulkQuotes partition:${requestData.partition}, offset:${requestData.offset}: ${err?.stack}`)
const fspiopSource = headers[FSPIOP.SOURCE]
await model.handleException(fspiopSource, bulkQuoteId, err, headers, span)
}
Expand Down
4 changes: 3 additions & 1 deletion src/lib/dto.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,14 @@ const messageFromRequestDto = (request, type, action) => {
}

const requestDataFromMessageDto = (message) => {
const { topic, value } = message
const { topic, value, offset, partition } = message

return Object.freeze({
topic,
requestData: {
...value.content,
offset,
partition,
payload: decodePayload(value.content?.payload)
// see messageFromRequestDto for details of "content" field
}
Expand Down

0 comments on commit a2bbb53

Please sign in to comment.