Uploaded image for project: 'Forge'
  1. Forge
  2. FORGE-1970

Copy cause's message to InvocationTargetException

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Do
    • Icon: Major Major
    • 2.x Future
    • None
    • None
    • None

      InvocationTargetException
      in arquillian-forge-core appears without any message and with null cause. The cause is in target property.
      Then the logging frameworks do not show the additional information.

      I suggest to either copy the error to the cause property, or at least to copy the message.

      I.e. change this in org.jboss.forge.arquillian.ForgeTestMethodExecutor

                              if (e.getCause() != null && e.getCause() instanceof Exception)
                                 throw (Exception) e.getCause();
                              else
                                 throw e;
      

      into something like

                            if (e.getCause() != null) {
                              if( e.getCause() instanceof Exception)
                                 throw (Exception) e.getCause();
                              else{
                                 e = new InvocationTargetException( target, target.getMessage);
                                 // And some reflection to set the cause.
      
                                 throw e;
                              }
                            }
      

      I would make a PR, but I didn't find where the repo for arq-forge-core is.

              Unassigned Unassigned
              ozizka_jira Ondrej Zizka (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: