public abstract class BaseException extends RuntimeException
Modifier | Constructor and Description |
---|---|
protected |
BaseException(ErrorCode errorCode)
Create a BaseException from an
ErrorCode . |
protected |
BaseException(ErrorCode errorCode,
Throwable cause)
|
Modifier and Type | Method and Description |
---|---|
static <E extends BaseException> |
createNew(Class<E> exceptionType,
ErrorCode errorCode)
Create a new subclass of BaseException from an
ErrorCode . |
<T> T |
get(String name)
Return a property of this exception.
|
List<String> |
getCauses()
Provides a list describing the causes of this exception.
|
String |
getDescription()
Provides additional information beyond the short message.
|
ErrorCode |
getErrorCode()
Retrieve the
ErrorCode of this exception. |
String |
getFix()
Provides advice on how to fix the root cause of the exception.
|
Map<String,Object> |
getProperties()
Return the properties of this exception.
|
String |
getUrl()
Provides an URL to online information about the root cause of the exception.
|
<E extends BaseException> |
put(String name,
Object value)
Put a property in this exception.
|
String |
toString()
The toString() method is overloaded to provide additional exception details.
|
static <E extends BaseException> |
wrap(Class<E> exceptionType,
Throwable throwable,
ErrorCode errorCode)
|
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
protected BaseException(ErrorCode errorCode)
ErrorCode
.errorCode
- the error code.public static <E extends BaseException> E createNew(Class<E> exceptionType, ErrorCode errorCode)
ErrorCode
.E
- the subtype.exceptionType
- the subclass of BaseException to create.errorCode
- the error code to set.public static <E extends BaseException> E wrap(Class<E> exceptionType, Throwable throwable, ErrorCode errorCode)
E
- the subtype.exceptionType
- the subclass of BaseException to create.throwable
- the existing throwable to wrap.errorCode
- the error code to set.public ErrorCode getErrorCode()
ErrorCode
of this exception.public Map<String,Object> getProperties()
public <T> T get(String name)
T
- the type of the property.name
- the name of the property.public <E extends BaseException> E put(String name, Object value)
E
- the type fo the property.name
- the name of the property.value
- the value of the property.public String toString()
public String getDescription()
public List<String> getCauses()
getDescription()
if
present or the message through Throwable.getMessage()
as a fallback.public String getFix()
public String getUrl()
Copyright © 2013-2018–2019 SeedStack. All rights reserved.