Skip to content

Commit

Permalink
change error messaging for paymentservice
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPSplunk committed May 31, 2024
1 parent 53bcbf8 commit 37a035b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/paymentservice/charge.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ module.exports.charge = async request => {
const randomNumber = Math.floor(Math.random() * 1000) + 1;
if (randomNumber <= failRate) {
let errorMsg="PaymentService charge failed. Bad API token (simulated).";
logger.error({transactionId, cardType, lastFourDigits, amount: { units, nanos, currencyCode }}, errorMsg);
//Already getting logged when the error is caught.
//logger.error({transactionId, cardType, lastFourDigits, amount: { units, nanos, currencyCode }}, errorMsg);
throw new Error(errorMsg);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/paymentservice/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async function chargeServiceHandler(call, callback) {
callback(null, response)

} catch (err) {
logger.warn({ err })
logger.error({ err })

span.recordException(err)
span.setStatus({ code: opentelemetry.SpanStatusCode.ERROR })
Expand Down

0 comments on commit 37a035b

Please sign in to comment.