-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
misc: remove sensitive data from log (#71)
- Loading branch information
Showing
8 changed files
with
269 additions
and
96 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
function logErrorResponse(response) { | ||
const status = response.status; | ||
const data = response.data; | ||
const headers = response.headers || {}; | ||
const rcRequestId = headers['rcrequestid']; | ||
console.error( | ||
'Response error: ', status, | ||
' RequestId: ', rcRequestId, | ||
' Data: ', | ||
data | ||
); | ||
} | ||
|
||
function errorLogger(error) { | ||
if (!error) { | ||
return; | ||
} | ||
if (error.response) { | ||
// https://axios-http.com/docs/handling_errors | ||
// The request was made and the server responded with a status code | ||
logErrorResponse(error.response); | ||
return; | ||
} | ||
if (error.request) { | ||
// The request was made but no response was received | ||
console.error('Request error: ', error.code); | ||
return; | ||
} | ||
console.error('Error: ', error.message); | ||
} | ||
|
||
exports.errorLogger = errorLogger; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters