Skip to content

Commit

Permalink
rename all catch params from 'e' to 'err'
Browse files Browse the repository at this point in the history
  • Loading branch information
LEQADA committed Apr 23, 2019
1 parent 99aca3f commit 67ad217
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion notification/src/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function getFileConfig () {
let fileConfig = {}
try {
fileConfig = require(configPath) // eslint-disable-line
} catch (e) {
} catch (err) {
// config file was not provided
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ async function ensureInterfaceInteractionCustomType (ctpClient) {
await ctpClient.create(ctpClient.builder.types, interfaceInteractionType)
logger.info('Successfully created an interfaceInteraction type')
}
} catch (e) {
logger.error(e, 'Error when creating interface interaction custom type, skipping...')
} catch (err) {
logger.error(err, 'Error when creating interface interaction custom type, skipping...')
}
}

Expand Down
14 changes: 7 additions & 7 deletions notification/src/handler/notification/notification.handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@ async function updatePaymentWithRepeater (payment, notification, ctpClient) {
logger.debug(`Payment with interfaceId ${currentPayment.interfaceId}`
+ 'was successfully updated')
break
} catch (e) {
if (e.body.statusCode !== 409)
} catch (err) {
if (err.body.statusCode !== 409)
throw new Error(`Unexpected error during updating a payment with ID: ${currentPayment.id}. Exiting. `
+ `Error: ${JSON.stringify(serializeError(e))}`)
+ `Error: ${JSON.stringify(serializeError(err))}`)
retryCount += 1
if (retryCount > maxRetry) {
retryMessage = 'Got a concurrent modification error'
+ ` when updating payment with id "${currentPayment.id}".`
+ ` Version tried "${currentVersion}",`
+ ` currentVersion: "${e.body.errors[0].currentVersion}".`
+ ` currentVersion: "${err.body.errors[0].currentVersion}".`
throw new Error(`${retryMessage} Won't retry again`
+ ` because of a reached limit ${maxRetry}`
+ ` max retries. Error: ${JSON.stringify(serializeError(e))}`)
+ ` max retries. Error: ${JSON.stringify(serializeError(err))}`)
}
/* eslint-disable-next-line no-await-in-loop */
currentPayment = await ctpClient.fetchById(ctpClient.builder.payments, currentPayment.id)
Expand Down Expand Up @@ -148,9 +148,9 @@ async function getPaymentByMerchantReference (merchantReference, ctpClient) {
try {
const result = await ctpClient.fetch(ctpClient.builder.payments.where(`interfaceId="${merchantReference}"`))
return _.get(result, 'body.results[0]', null)
} catch (e) {
} catch (err) {
throw Error(`Failed to fetch a payment with merchantReference: ${merchantReference}. `
+ `Error: ${JSON.stringify(serializeError(e))}`)
+ `Error: ${JSON.stringify(serializeError(err))}`)
}
}

Expand Down
4 changes: 2 additions & 2 deletions notification/src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ function setupServer (routes = defaultRoutes) {
if (route)
try {
await route(request, response)
} catch (e) {
logger.error(e, `Unexpected error when processing URL ${JSON.stringify(parts)}`)
} catch (err) {
logger.error(err, `Unexpected error when processing URL ${JSON.stringify(parts)}`)
utils.sendResponse(response, 500)
}
else
Expand Down

0 comments on commit 67ad217

Please sign in to comment.