Aariz#10529
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Code Review
This pull request refactors logging and error handling within the Crashlytics build tools helper. Key changes include simplifying a debug log statement, ensuring outputs.stdout is present before logging warnings, and including the process exit status when throwing a FirebaseError. A review comment correctly identified that wrapping the warning message in a new Error object to access its .message property is redundant and suggested a more direct implementation.
| if (!debug && outputs.stdout) { | ||
| utils.logWarning(new Error(outputs.stdout?.toString() || "An unknown error occurred").message); | ||
| } |
There was a problem hiding this comment.
The use of new Error(...).message is redundant and adds unnecessary overhead, as it simply returns the string passed to the constructor. Since outputs.stdout is already checked for truthiness in the if condition, you can directly call .toString() on it. Additionally, the optional chaining operator ?. is unnecessary given the preceding check.
| if (!debug && outputs.stdout) { | |
| utils.logWarning(new Error(outputs.stdout?.toString() || "An unknown error occurred").message); | |
| } | |
| if (!debug && outputs.stdout) { | |
| utils.logWarning(outputs.stdout.toString() || "An unknown error occurred"); | |
| } |
Wiz Scan Summary
To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension. |
Description
Scenarios Tested
Sample Commands