| 1 | package com.github.dakusui.osynth.exceptions; | |
| 2 | ||
| 3 | import java.lang.reflect.InvocationTargetException; | |
| 4 | ||
| 5 | public class OsynthException extends RuntimeException { | |
| 6 | public OsynthException(Throwable e) { | |
| 7 | super(e); | |
| 8 | } | |
| 9 | ||
| 10 | public OsynthException(String message) { | |
| 11 | super(message); | |
| 12 | } | |
| 13 | ||
| 14 | public OsynthException(String message, Throwable cause) { | |
| 15 | super(message, cause); | |
| 16 | } | |
| 17 | ||
| 18 | public static OsynthException from(String customMessage, Throwable e) { | |
| 19 |
1
1. from : negated conditional → KILLED |
if (e instanceof Error) |
| 20 | throw (Error) e; | |
| 21 |
1
1. from : negated conditional → KILLED |
if (e instanceof InvocationTargetException) |
| 22 | // False-missing coverage because of JaCoCo limitation | |
| 23 | throw from(customMessage, ((InvocationTargetException) e).getTargetException()); | |
| 24 |
1
1. from : negated conditional → KILLED |
else if (e instanceof OsynthException) |
| 25 |
1
1. from : negated conditional → KILLED |
if (e.getCause() == null) |
| 26 | throw (OsynthException) e; | |
| 27 | else | |
| 28 | // False-missing coverage because of JaCoCo limitation | |
| 29 | throw from(customMessage, e.getCause()); | |
| 30 |
1
1. from : negated conditional → KILLED |
else if (e instanceof RuntimeException) |
| 31 | throw (RuntimeException)e; | |
| 32 | else { | |
| 33 |
1
1. from : negated conditional → KILLED |
if (customMessage == null) |
| 34 | throw new OsynthException(e); | |
| 35 | else | |
| 36 | throw new OsynthException(customMessage, e); | |
| 37 | } | |
| 38 | } | |
| 39 | } | |
Mutations | ||
| 19 |
1.1 |
|
| 21 |
1.1 |
|
| 24 |
1.1 |
|
| 25 |
1.1 |
|
| 30 |
1.1 |
|
| 33 |
1.1 |