Skip to content
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

Merged
merged 2 commits into from
Jul 11, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ async function runOnAllDevices(

function createInstallError(error: Error & {stderr: string}) {
const stderr = (error.stderr || '').toString();
let message = error.message ?? '';
let message = '';
// Pass the error message from the command to stdout because we pipe it to
// parent process so it's not visible
logger.log(stderr);
Expand All @@ -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 ? ' ' + message : ''}`,
error.message.length > 0 ? undefined : error,
Copy link
Collaborator

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?

Copy link
Contributor Author

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)

Copy link
Member

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?

);
}

Expand Down