Class AnchorFriendlyRuntimeException
Object
Throwable
Exception
RuntimeException
AnchorRuntimeException
AnchorFriendlyRuntimeException
- All Implemented Interfaces:
Serializable
,HasFriendlyErrorMessage
- Direct Known Subclasses:
AnchorImpossibleSituationException
,BeanDuplicateException
,BeanStrangeException
,CheckedStream.ConvertedToRuntimeException
,CommandLineException
,IncorrectVoxelTypeException
,OutputDirectoryAlreadyExistsException
public class AnchorFriendlyRuntimeException
extends AnchorRuntimeException
implements HasFriendlyErrorMessage
A base class for particular runtime-exceptions which are guaranteed to provide a user-friendly
error description.
See the counterpart AnchorFriendlyCheckedException
.
- Author:
- Owen Feehan
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAnchorFriendlyRuntimeException
(String message) A user-friendly error message without a cause.AnchorFriendlyRuntimeException
(String message, Throwable cause) A user-friendly error message and its cause.A wrapped exception. -
Method Summary
Modifier and TypeMethodDescriptionA friendly message to describe to the user what went wrong.A friendly message to describe to the user what went wrong, which doesn't impose a fixed-size, or showExceptionNamesvoid
friendlyMessageHierarchy
(Writer writer, int wordWrapLimit, boolean showExceptionNames) A friendly message to describe to the user what went wrong, including all nested exceptions that have a non-empty error messageMethods inherited from class org.anchoranalysis.core.exception.AnchorRuntimeException
toString
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
Constructor Details
-
AnchorFriendlyRuntimeException
A user-friendly error message and its cause. The message is displayed to the user.- Parameters:
message
- a user-friendly error message to display to the user indicating the problem.cause
- the cause of the error.
-
AnchorFriendlyRuntimeException
A user-friendly error message without a cause. This exception is displayed to the user. There are no more nested-errors possible.- Parameters:
message
- cause the cause of the error.
-
AnchorFriendlyRuntimeException
A wrapped exception. We skip it in error reports.- Parameters:
cause
- the cause of the error.
-
-
Method Details
-
friendlyMessage
Description copied from interface:HasFriendlyErrorMessage
A friendly message to describe to the user what went wrong. If no message has been defined in this exception, we keep iterating the hierarchy until we find a message- Specified by:
friendlyMessage
in interfaceHasFriendlyErrorMessage
- Returns:
- a string describing what went wrong
-
friendlyMessageHierarchy
Description copied from interface:HasFriendlyErrorMessage
A friendly message to describe to the user what went wrong, which doesn't impose a fixed-size, or showExceptionNames- Specified by:
friendlyMessageHierarchy
in interfaceHasFriendlyErrorMessage
- Returns:
- a string (often multi-lined) describing a hierarchy of errors that occurred
-
friendlyMessageHierarchy
public void friendlyMessageHierarchy(Writer writer, int wordWrapLimit, boolean showExceptionNames) throws IOException Description copied from interface:HasFriendlyErrorMessage
A friendly message to describe to the user what went wrong, including all nested exceptions that have a non-empty error messageIt starts the least-most-nested exception. It ends with the further-most-nested exception (cause).
- Specified by:
friendlyMessageHierarchy
in interfaceHasFriendlyErrorMessage
- Parameters:
writer
- where the friendly-messaged is outputtedwordWrapLimit
- a fixed-width size for the message and indentation (ignoring the exception name). -1 disables.showExceptionNames
- show exception-names after the error output- Throws:
IOException
- if an I/O error occurs with the writer
-