Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-30730

AbstractBuildExecution#reportError should work will any kind of Build Step

XMLWordPrintable

      AbstractBuildExecution#reportError should work will any kind of Build Step.

      Right now, reportError supposes that all the build steps are Publishers, but according with the code it should work with any kind of BuildStep.

              private void reportError(BuildStep bs, Throwable e, BuildListener listener, boolean phase) {
                  final String publisher = ((Publisher) bs).getDescriptor().getDisplayName();
      
                  if (e instanceof AbortException) {
                      LOGGER.log(Level.FINE, "{0} : {1} failed", new Object[] {AbstractBuild.this, publisher});
                      listener.error("Publisher '" + publisher + "' failed: ");
                      listener.error(e.getMessage());
                  } else {
                      String msg = "Publisher '" + publisher + "' aborted due to exception: ";
                      e.printStackTrace(listener.error(msg));
                      LOGGER.log(WARNING, msg, e);
                  }
      
                  if (phase) {
                      setResult(Result.FAILURE);
                  }
              }
      

            fbelzunc Félix Belzunce Arcos
            fbelzunc Félix Belzunce Arcos
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: