prezi / pride

Manages a pride of Gradle modules
Other
71 stars 13 forks source link

Slightly misleading error message when failing to evaluate project #148

Closed rosadam closed 9 years ago

rosadam commented 9 years ago

Problem

When trying to issue a pride command and one of the projects cannot be evaluated, because of some exception the following error will be printed:

Could not parse module in <module-dir>

See: https://github.com/prezi/pride/blob/e6716935394ada4f965f1b7cac624d621550945b/pride/src/main/java/com/prezi/pride/cli/model/ProjectModelAccessor.java#L62 It is misleading because it is not about parsing, but evaluating the project. If you issue a simple ./gradlew command the following error will be printed:

A problem occurred evaluating project ':<project-name>'.

Suggested solution

Change the output to

Could not evaluate module in <module-dir>. Run './gradlew' in the pride root to get more information about the error

Why? The ./gradlew command will evaluate the projects too, and print out a user-friendly error message with more information about the actual problem.

lptr commented 9 years ago

I'll put it here as well: the errors are show as part of the log already, no? So the error message could point people to scroll a little up, and see it there. Or we could actually record any errors coming from Gradle, and present them here in a more collected way.

rosadam commented 9 years ago

No it is not shown as part of the log. It looks like this:

ERROR: Could not parse module in /my/module/path: org.gradle.tooling.BuildException: Could not fetch model of type 'PrideProjectModel' using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.4-bin.zip'.

Another solution might be to inform the user to run the same command with --verbose just like gradle does:

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
lptr commented 9 years ago

Oh, I see. So when the build fails to run, Pride masks that by this error. Maybe when we get an exception getting the model, we could rerun the build through the tooling API, but this time instead of asking for a PrideProjectModel, we could just run ./gradlew doNothing, and show the exception there. I'll look into this.

On Mon, Jun 22, 2015 at 10:31 AM rosadam notifications@github.com wrote:

No it is not shown as part of the log. It looks like this:

ERROR: Could not parse module in /my/module/path: org.gradle.tooling.BuildException: Could not fetch model of type 'PrideProjectModel' using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.4-bin.zip'.

Another solution might be to inform the user to run the same command with --verbose just like gradle does:

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

— Reply to this email directly or view it on GitHub https://github.com/prezi/pride/issues/148#issuecomment-114038648.

Lóránt