JetBrains / intellij-platform-gradle-plugin

Gradle plugin for building plugins for IntelliJ-based IDEs
https://plugins.jetbrains.com/docs/intellij/gradle-prerequisites.html
Apache License 2.0
1.44k stars 272 forks source link

failed to upload plugin #193

Closed SingingBush closed 7 years ago

SingingBush commented 7 years ago

I know this kind of duplicates #143 but this is more a request to output a better error message. Rather than output 'Failed to upload plugin' it would be nice to let the user know what error code was returned from plugins.jetbrains.com or if the problem was elsewhere.

zolotov commented 7 years ago

Have you tried --stacktrace option?

The plugin gives you all information that it has, it cannot be improved on this side. You may want to create an issue in https://github.com/JetBrains/plugin-repository-rest-client project.

SingingBush commented 7 years ago

I enabled --info for the build and found that part of my problem was down to travis-ci ignoring env when doing a deploy (although it's still failing to upload for some other reason, possibly to do with channels). However, increasing the log level isn't supposed to be an alternative for useful error messages.

for a little more context, here's the relevant ssection of my build log with --info:

:publishPlugin
Putting task artifact state for task ':publishPlugin' into context took 0.0 secs.
Executing task ':publishPlugin' (up-to-date check took 0.0 secs) due to:
  Task has not declared any outputs.
Uploading plugin net.masterthought.dlanguage from /home/travis/build/kingsleyh/DLanguage/build/distributions/intellij-dlanguage-1.13-dev400.zip to http://plugins.jetbrains.com, channel: dev
Uploading plugin net.masterthought.dlanguage from /home/travis/build/kingsleyh/DLanguage/build/distributions/intellij-dlanguage-1.13-dev400.zip to http://plugins.jetbrains.com
:publishPlugin FAILED
:publishPlugin (Thread[Daemon worker Thread 2,5,main]) completed. Took 1.884 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':publishPlugin'.
> Failed to upload plugin
* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.
BUILD FAILED

the uploadPlugin method in plugin-repository-rest-client throws a RetrofitError which contains the server response so it would certainly be possible to log an error message which let's people know the status code that came back from the rest api.

zolotov commented 7 years ago

--stacktrace is supposed to be a useful error message, if you can invent a log message that is better – PR is welcome

SingingBush commented 7 years ago

ok, was about to make change for PR but seen that the rest client has overloaded uploadPlugin one that throws the Retrofit error and one which doesn't (which is the one you use). I was planning on changing the catch block to something like:

catch (RetrofitError exception) {
    IntelliJPlugin.LOG.error("$host responded with ${exception.response.status}", exception)
    throw new TaskExecutionException(this, new RuntimeException("Failed to upload plugin", exception))
}
zolotov commented 7 years ago

that throws the Retrofit error and one which doesn't (which is the one you use)

Nice catch, I believe it should be fixed in the rest client.