fix(ng-dev/caretaker): redact raw error objects from caretaker logs#3759
Open
josephperrott wants to merge 1 commit into
Open
fix(ng-dev/caretaker): redact raw error objects from caretaker logs#3759josephperrott wants to merge 1 commit into
josephperrott wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request improves error logging across several caretaker modules by safely handling caught errors, ensuring stack is defined before logging, and converting non-Error objects to strings. A review comment suggests simplifying the logging logic in update-github-team.ts to avoid duplicate log entries, as Error.prototype.stack already includes the error message.
Comment on lines
+99
to
+106
| if (e instanceof Error) { | ||
| Log.debug(e.message); | ||
| if (e.stack) { | ||
| Log.debug(e.stack); | ||
| } | ||
| } else { | ||
| Log.debug(String(e)); | ||
| } |
There was a problem hiding this comment.
In Node.js, Error.prototype.stack already includes the error message as its first line. Logging both e.message and e.stack at the same Log.debug level results in duplicate log entries. We can simplify this by logging e.stack if it exists, and falling back to e.message otherwise.
if (e instanceof Error) {
Log.debug(e.stack ?? e.message);
} else {
Log.debug(String(e));
}47c3424 to
520fb26
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses ce4ab3d8. Redacts raw error objects in caretaker logs to prevent sensitive token leakage.