View Javadoc

1   package cz.cuni.amis.pogamut.sposh.exceptions;
2   
3   import cz.cuni.amis.pogamut.sposh.executor.ParamsAction;
4   import cz.cuni.amis.pogamut.sposh.executor.ParamsSense;
5   import java.lang.reflect.InvocationTargetException;
6   
7   /**
8    * Unchecked exception that is used to wrap other exceptions thrown in some
9    * method. Used instead of checked {@link InvocationTargetException} in the
10   * parametrized primitives ({@link ParamsAction} and {@link ParamsSense}).
11   *
12   * @author Honza Havlicek
13   */
14  public class MethodException extends RuntimeException {
15  
16      public MethodException(String message, Throwable cause) {
17          super(message, cause);
18      }
19  
20      public MethodException(String message) {
21          super(message);
22      }
23  
24      @Override
25      public String getMessage() {
26          if (getCause() != null) {
27              return super.getMessage() + ' ' + getCause().getMessage();
28          } else {
29              return super.getMessage();
30          }
31      }
32      
33      
34  }