1 package com.lexicalscope.fluentreflection;
2
3 import java.lang.reflect.InvocationTargetException;
4 import java.lang.reflect.Member;
5
6 public class InvocationTargetRuntimeException extends ReflectionRuntimeException {
7 private static final long serialVersionUID = -4623735792822350866L;
8 private Throwable exceptionThrownByInvocationTarget;
9
10 private InvocationTargetRuntimeException(final String message, final Throwable cause) {
11 super(message, cause);
12 }
13
14 public InvocationTargetRuntimeException(final InvocationTargetException cause, final Member member) {
15 this("Exception while invoking " + member, cause);
16 exceptionThrownByInvocationTarget = cause.getCause();
17 }
18
19 public Throwable getExceptionThrownByInvocationTarget() {
20 return exceptionThrownByInvocationTarget;
21 }
22 }