public class ExampleException extends Exception { public ExampleException() { this(null, null); } public ExampleException(String message) { this(message, null); } public ExampleException(Throwable cause) { this(cause != null ? cause.getMessage() : null, cause); } public ExampleException(String message, Throwable cause) { super(message); if (cause != null) super.initCause(cause); } }