Interface ExceptionCode
public interface ExceptionCode
An interface to model exception code, short description and enable creating
CommonRuntimeException-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ThrowableNull Throwable used while building exception not requiring the cause. -
Method Summary
Modifier and TypeMethodDescriptionShort description of the error.default org.springframework.http.HttpStatusGet http status.name()Short name of the error/exception code.default CommonRuntimeExceptionACommonRuntimeExceptiongenerator givengetDescription()serving as a message.default CommonRuntimeExceptiontoCommonRTE(String message) ACommonRuntimeExceptiongenerator given a message.default CommonRuntimeExceptiontoCommonRTE(String template, Object... args) Deprecated, for removal: This API element is subject to removal in a future version.default CommonRuntimeExceptiontoCommonRTE(String message, String template, Object... args) ACommonRuntimeExceptioncreator given message, details template and argsdefault CommonRuntimeExceptiontoCommonRTE(String template, Map<String, Object> args) Deprecated, for removal: This API element is subject to removal in a future version.in favour oftoCommonRTE(Throwable, String, String, Object...).default CommonRuntimeExceptiontoCommonRTE(Throwable cause, String message) ACommonRuntimeExceptiongenerator given a cause and message.default CommonRuntimeExceptiontoCommonRTE(Throwable cause, String message, String template, Object... args) ACommonRuntimeExceptioncreator given cause, message, details template and argsdefault CommonRuntimeExceptiontoCommonRTE(MessageFormat template, Object... args) Deprecated, for removal: This API element is subject to removal in a future version.in favour oftoCommonRTE(Throwable, String, String, Object...).Please do not use this
-
Field Details
-
NULL_CAUSE
Null Throwable used while building exception not requiring the cause.
-
-
Method Details
-
name
String name()Short name of the error/exception code.- Returns:
- name/code of the error.
-
getDescription
String getDescription()Short description of the error.- Returns:
- description.
-
getStatus
default org.springframework.http.HttpStatus getStatus()Get http status.- Returns:
HttpStatus
-
toCommonRTE
ACommonRuntimeExceptiongenerator givengetDescription()serving as a message. This exception should be further updated with detailed message to have all the contextual details.- Returns:
CommonRuntimeException
-
toCommonRTE
ACommonRuntimeExceptiongenerator given a message. This exception should be further updated with detailed message to have all the contextual details.- Parameters:
message- for Exception- Returns:
CommonRuntimeException
-
toCommonRTE
ACommonRuntimeExceptiongenerator given a cause and message. This exception should be further updated with detailed message to have all the contextual details.- Parameters:
cause- the original cause of the error to be set within this exception.message- for Exception- Returns:
CommonRuntimeException
-
toCommonRTE
ACommonRuntimeExceptioncreator given message, details template and args- Parameters:
message- the exception messagetemplate- the details message templateargs- the arguments (either could be just one Map of key-value or var-args)- Returns:
CommonRuntimeException
-
toCommonRTE
default CommonRuntimeException toCommonRTE(Throwable cause, String message, String template, Object... args) ACommonRuntimeExceptioncreator given cause, message, details template and args- Parameters:
cause- the original cause of the error to be set within this exceptionmessage- the exception messagetemplate- the details message templateargs- the arguments (either could be just one Map of key-value or var-args)- Returns:
CommonRuntimeException
-
toCommonRTE
@Deprecated(since="1.5", forRemoval=true) default CommonRuntimeException toCommonRTE(String template, Object... args) Deprecated, for removal: This API element is subject to removal in a future version.in favour oftoCommonRTE(Throwable, String, String, Object...). Please do not use thisACommonRuntimeExceptiongenerator setting the message ofgetDescription()- Parameters:
template- a SLF4J style formatted template (for eg: "Server error:{}") where placeholders to be substituted.args- the parameters are stringifiable var-args to be used to replace each placeholder template- Returns:
CommonRuntimeException
-
toCommonRTE
@Deprecated(since="1.5", forRemoval=true) default CommonRuntimeException toCommonRTE(String template, Map<String, Object> args) Deprecated, for removal: This API element is subject to removal in a future version.in favour oftoCommonRTE(Throwable, String, String, Object...). Please do not use thisACommonRuntimeExceptionwith message usinggetDescription()along with detailed map of parameters.- Parameters:
template- for a detailed message that needs variable interpolated based on substitution markersargs- the parameters to be used to replace the markered template- Returns:
CommonRuntimeException
-
toCommonRTE
@Deprecated(since="1.5", forRemoval=true) default CommonRuntimeException toCommonRTE(MessageFormat template, Object... args) Deprecated, for removal: This API element is subject to removal in a future version.in favour oftoCommonRTE(Throwable, String, String, Object...).Please do not use thisACommonRuntimeExceptiongenerator given- Parameters:
template- aformatted detailed messagethat would be processed byMessageFormatargs- the parameters to be used to replace the markers supported byMessageFormat- Returns:
CommonRuntimeException
-
toCommonRTE(Throwable, String, String, Object...).