Skip to content
This repository has been archived by the owner on May 1, 2020. It is now read-only.

Add Error Logging #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions src/loan-returned/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports.handle = (event, context, callback) => {
callback(null, generateSuccessMessage(loanData.item_loan.loan_id))
})
.catch(e => {
console.log(e)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you look at adding a proper nodejs logging library making use of info, debug etc. The full stack trace e should only be done on debug - Generally just a message saying Failed to retrieve loan X is better

callback(new Error(`Failed to delete Loan ${loanData.item_loan.loan_id} for User ${loanData.item_loan.user_id} in Cache`))
})
} catch (e) {
Expand Down
1 change: 1 addition & 0 deletions src/loan-updated/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports.handle = (event, context, callback) => {
callback(null, generateSuccessMessage(loanData.item_loan.loan_id))
})
.catch(e => {
console.log(e)
callback(new Error(`Failed to update Loan ${loanData.item_loan.loan_id} for User ${loanData.item_loan.user_id} in Cache`))
})
} catch (e) {
Expand Down
1 change: 1 addition & 0 deletions src/request-closed/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports.handle = (event, context, callback) => {
callback(null, generateSuccessMessage(requestData.user_request.request_id))
})
.catch(e => {
console.log(e)
callback(new Error(`Failed to delete Request ${requestData.user_request.request_id} for User ${requestData.user_request.user_primary_id} in Cache`))
})
} catch (e) {
Expand Down
1 change: 1 addition & 0 deletions src/request-updated/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports.handle = (event, context, callback) => {
callback(null, generateSuccessMessage(requestData.user_request.request_id))
})
.catch(e => {
console.log(e)
callback(new Error(`Failed to update Request ${requestData.user_request.request_id} for User ${requestData.user_request.user_primary_id} in Cache`))
})
} catch (e) {
Expand Down