-
Notifications
You must be signed in to change notification settings - Fork 905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix : Getting rid of duplicate gradle error messages #2004
Conversation
@@ -148,8 +148,8 @@ function createInstallError(error: Error & {stderr: string}) { | |||
} | |||
|
|||
return new CLIError( | |||
`Failed to install the app. ${message}`, | |||
message.length > 0 ? undefined : error, | |||
`Failed to install the app.${message || ''}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spacing bug? Currently this would print
Failed to install the app.Make sure you have an Android emulator running or a device connected.
`Failed to install the app.${message || ''}`, | |
`Failed to install the app.${message ? (' ' + message) : ''}`, |
`Failed to install the app. ${message}`, | ||
message.length > 0 ? undefined : error, | ||
`Failed to install the app.${message || ''}`, | ||
error.message.length > 0 ? undefined : error, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this line. Isn't error.message
always going to be some non-empty string? What's the point of this edge case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are cases when error is empty in which empty error is passed to CLIError which causes the stack to be printed. In that case we have absolutely no idea of what went wrong which is why printing the stack trace only makes sense.
For those edge cases, this would be printed :
at makeError (/Users/arushikesarwani/cli/node_modules/execa/index.js:174:9)
at module.exports.sync (/Users/arushikesarwani/cli/node_modules/execa/index.js:338:15)
at getGradleTasks (/Users/arushikesarwani/cli/packages/cli-platform-android/build/commands/runAndroid/listAndroidTasks.js:53:32)
at getTaskNames (/Users/arushikesarwani/cli/packages/cli-platform-android/build/commands/runAndroid/getTaskNames.js:21:73)
at runOnAllDevices (/Users/arushikesarwani/cli/packages/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:61:55)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Command.handleAction (/Users/arushikesarwani/cli/packages/cli/build/index.js:111:9)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we know what exactly throws an empty error?
* Getting rid of duplicate gradle error messages * Spacing fix
Summary:
Getting rid of duplicate error logging for Gradle. Leaving error messages for specific cases like :
in place where we already know what's wrong and provide more helpful error message instead of dumping gradle error. However in all other generic cases, getting rid of duplicate error messages for Gradle.
Test Plan:
node ./scripts/build.js && yarn build:debugger
cd packages/cli-platform-android
yarn link
yarn link "@react-native-community/cli-platform-android"
to see successful linking :BEFORE :
AFTER :