- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- io.github.mmm.base.exception.ApplicationException
-
- io.github.mmm.nls.exception.TechnicalErrorUserException
-
- All Implemented Interfaces:
Localizable,LocalizableObject,Serializable
public class TechnicalErrorUserException extends ApplicationException
ATechnicalErrorUserExceptionis wrapping an arbitrary technical error to a generic exception for end-users or clients. It helps to prevent "sensitive data exposure", an OWASP top ten security vulnerability.- Since:
- 1.0.0
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TechnicalErrorUserException(NlsMessage message, Throwable nested)The constructor for the very special case that you want to define a custom message.TechnicalErrorUserException(Throwable cause)The constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ApplicationExceptionconvert(Throwable exception)StringgetCode()This method gets the code that identifies the detailed type of this object.booleanisForUser()Note: Please consider usingnet.sf.mmm.nls.exception.NlsExceptionwith i18n support in case you are creating exceptions for end-users.booleanisTechnical()Determines if this is a technical exception.-
Methods inherited from class io.github.mmm.base.exception.ApplicationException
createUuid, getLocalizedMessage, getLocalizedMessage, getMessage, getNlsMessage, getNlsMessage, getUuid, printStackTrace, toString, toString, toString
-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.github.mmm.base.i18n.Localizable
getArgument, getLocalizedMessage, toLocalizable
-
-
-
-
Field Detail
-
CODE
public static final String CODE
- See Also:
getCode(), Constant Field Values
-
-
Constructor Detail
-
TechnicalErrorUserException
public TechnicalErrorUserException(Throwable cause)
The constructor.- Parameters:
cause- is thecause.
-
TechnicalErrorUserException
public TechnicalErrorUserException(NlsMessage message, Throwable nested)
The constructor for the very special case that you want to define a custom message. You are not encouraged to use this constructor. Please also consider that you can still customize the localized texts for the message when usingTechnicalErrorUserException(Throwable).
-
-
Method Detail
-
getCode
public final String getCode()
Description copied from class:ApplicationExceptionThis method gets the code that identifies the detailed type of this object. WhileUUIDis unique per instance of aApplicationExceptionthis code is a short and readable identifier representing theApplicationExceptionClass. The default implementation returns thesimple name. However, the code should remain stable after refactoring (so at least after the rename the previous code should be returned asStringliteral). This code may be used as a compact identifier to reference the related problem or information as well as for automatic tests of error situations that should remain stable even if the message text gets improved or the locale is unknown.- Overrides:
getCodein classApplicationException- Returns:
- the error code.
-
isTechnical
public final boolean isTechnical()
Description copied from class:ApplicationExceptionDetermines if this is a technical exception.- A technical exception is an unexpected situation that is to be logged on error level and should be analyzed by
the operators or software developers of the system. Further in such case the end-user can typically do nothing
about the problem (except to retry his operation) and will typically not understand the problem. Therefore a
generic message should be
displayed to the end-userin such case. - A non technical exception is called user failure. It is an undesired but NOT abnormal situation (e.g.
a mandatory field was not filled). It should be logged on a level less than error (typically info). The
messageis typicallyintended for to end-usersand has to be easy to understand.
- Overrides:
isTechnicalin classApplicationException- Returns:
trueif this is a technical exception,falseif this is a user error.- See Also:
ApplicationException.isForUser()
- A technical exception is an unexpected situation that is to be logged on error level and should be analyzed by
the operators or software developers of the system. Further in such case the end-user can typically do nothing
about the problem (except to retry his operation) and will typically not understand the problem. Therefore a
generic message should be
-
isForUser
public final boolean isForUser()
Description copied from class:ApplicationExceptionNote: Please consider usingnet.sf.mmm.nls.exception.NlsExceptionwith i18n support in case you are creating exceptions for end-users.- Overrides:
isForUserin classApplicationException- Returns:
trueif themessageof this exception is for end-users (or clients),falseotherwise (for internaltechnicalerrors).
-
convert
public static ApplicationException convert(Throwable exception)
- Parameters:
exception- is theThrowableto convert.- Returns:
- the
ApplicationExceptionwithisForUser()returningtrue.
-
-