Package com.helger.commons.error
Interface IError
-
- All Superinterfaces:
IErrorIndicator,IGenericImplTrait<IError>,IHasErrorField,IHasErrorID,IHasErrorLevel,IHasErrorLevelComparable<IError>,ISeverityComparable<IError>,ISuccessIndicator
- All Known Implementing Classes:
SingleError
@MustImplementEqualsAndHashcode public interface IError extends IHasErrorLevelComparable<IError>, IHasErrorID, IHasErrorField
Common interface for single errors and resource errors.- Since:
- 8.5.0
- Author:
- Philip Helger
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default StringgetAsString(Locale aContentLocale)Get the error as a string representation, including error ID, error location, error text and the linked exception.default LocalDateTimegetErrorDateTime()default StringgetErrorFieldName()default StringgetErrorID()default ILocationgetErrorLocation()default StringgetErrorText(Locale aContentLocale)Get the error message of this error.default IHasErrorTextgetErrorTexts()default ThrowablegetLinkedException()default ThrowablegetLinkedExceptionCause()default StringgetLinkedExceptionMessage()default StackTraceElement[]getLinkedExceptionStackTrace()default booleanhasErrorDateTime()Check if a error date time is present.default booleanhasErrorLocation()Check if a reasonable error location is present.default booleanhasLinkedException()-
Methods inherited from interface com.helger.commons.traits.IGenericImplTrait
thisAsT
-
Methods inherited from interface com.helger.commons.error.IHasErrorField
hasErrorFieldName, hasErrorFieldName, hasNoErrorFieldName
-
Methods inherited from interface com.helger.commons.error.IHasErrorID
hasErrorID, hasErrorID, hasNoErrorID
-
Methods inherited from interface com.helger.commons.error.level.IHasErrorLevel
getErrorLevel, hasErrorLevel, isError, isFailure, isNoError, isSuccess
-
Methods inherited from interface com.helger.commons.error.level.IHasErrorLevelComparable
compareTo, isEQ, isGE, isGT, isLE, isLT, isNE
-
Methods inherited from interface com.helger.commons.state.ISuccessIndicator
and, or
-
-
-
-
Method Detail
-
getErrorDateTime
@Nullable default LocalDateTime getErrorDateTime()
- Returns:
- The date and time when the error occurred. Defaults to
nullfor backwards compatibility. - Since:
- 10.1.7
-
hasErrorDateTime
default boolean hasErrorDateTime()
Check if a error date time is present.- Returns:
trueif error date time information is present,falseotherwise.- Since:
- 10.1.7
- See Also:
getErrorDateTime()
-
getErrorID
default String getErrorID()
- Specified by:
getErrorIDin interfaceIHasErrorID- Returns:
- The error ID. May be
null.
-
getErrorFieldName
@Nullable default String getErrorFieldName()
- Specified by:
getErrorFieldNamein interfaceIHasErrorField- Returns:
- The field for which the error occurred. May be
null.
-
getErrorLocation
@Nonnull default ILocation getErrorLocation()
- Returns:
- The non-
nulllocation of the error. UseSimpleLocation.NO_LOCATIONto indicate no location is available. - See Also:
hasErrorLocation()
-
hasErrorLocation
default boolean hasErrorLocation()
Check if a reasonable error location is present.- Returns:
trueif location information is present,falseotherwise.- See Also:
getErrorLocation()
-
getErrorTexts
@Nullable default IHasErrorText getErrorTexts()
- Returns:
- The contained error message text. May be
null. - See Also:
getErrorText(Locale)
-
getErrorText
@Nullable default String getErrorText(@Nonnull Locale aContentLocale)
Get the error message of this error.- Parameters:
aContentLocale- The locale to be used in case the error text is available in multiple languages.- Returns:
- The message of this form error. May be
nullin case no error text is available or if the passed Locale is not supported. - See Also:
getErrorTexts()
-
getLinkedException
@Nullable default Throwable getLinkedException()
- Returns:
- The linked exception or
nullif no such exception is available. - See Also:
hasLinkedException(),getLinkedExceptionMessage(),getLinkedExceptionStackTrace(),getLinkedExceptionCause()
-
hasLinkedException
default boolean hasLinkedException()
- Returns:
trueif a linked exception is present,falseif not.- See Also:
getLinkedException()
-
getLinkedExceptionMessage
@Nullable default String getLinkedExceptionMessage()
- Returns:
- The message of the linked exception or
nullif no such exception is available. - See Also:
getLinkedException()
-
getLinkedExceptionStackTrace
@Nullable default StackTraceElement[] getLinkedExceptionStackTrace()
- Returns:
- The stack trace of the linked exception or
nullif no such exception is available. - See Also:
getLinkedException()
-
getLinkedExceptionCause
@Nullable default Throwable getLinkedExceptionCause()
- Returns:
- The cause of the linked exception or
nullif no such exception is available. - See Also:
getLinkedException()
-
getAsString
@Nonnull @Nonempty default String getAsString(@Nonnull Locale aContentLocale)
Get the error as a string representation, including error ID, error location, error text and the linked exception.- Parameters:
aContentLocale- Locale to resolve the error text- Returns:
- The default string representation
-
-