Package org.ametys.plugins.core.ui
Class ObfuscatedException
java.lang.Object
java.lang.Throwable
java.lang.Exception
org.ametys.plugins.core.ui.ObfuscatedException
- All Implemented Interfaces:
Serializable
Wraps a throwable preventing access to it until
reveal() is called.
Before to being revealed, printing the exception will only result in a message providing a error reference.
Once revealed, printing the exception will result in a message providing the error reference and the original exception.
It is intended for case where an error report should be provided to a user. As it is not acceptable to provide stack trace
directly. First print the obfuscated exception to the user, then reveal it and log the error.- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedObfuscatedException(String reference, Throwable throwable) Construct an obfuscated exception with the given reference for the given exception -
Method Summary
Modifier and TypeMethodDescriptiongetCause()Get the reference of the obfuscated exceptionvoidObfuscate the original exception.static ObfuscatedExceptionObfuscate an exception.voidreveal()Stop obfuscating the original exception.toString()Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
Constructor Details
-
ObfuscatedException
Construct an obfuscated exception with the given reference for the given exception- Parameters:
reference- the referencethrowable- the throwable
-
-
Method Details
-
obfuscate
Obfuscate an exception. A reference will be generated for the exception.- Parameters:
throwable- the throwable to obfuscate- Returns:
- the obfuscated exception
-
getReference
Get the reference of the obfuscated exception- Returns:
- the reference
-
toString
-
obfuscate
Obfuscate the original exception. After calling this, the original exception will be obfuscated untilreveal()is called -
reveal
Stop obfuscating the original exception. After calling this, the original exception won't be obfuscated any more. -
getCause
-