Class LocalisedBeanException
Object
Throwable
Exception
org.anchoranalysis.core.exception.AnchorCheckedException
org.anchoranalysis.core.exception.combinable.AnchorCombinableException
org.anchoranalysis.bean.xml.exception.LocalisedBeanException
- All Implemented Interfaces:
Serializable
public class LocalisedBeanException extends AnchorCombinableException
Combines a chain of many exceptions into a single exception, searching for an ultimate cause and
incorporating the messages from the chain into a single unified message.
To do this, all nested exceptions are traversed until null is found as a cause.
To determine the message string:
- If the exception is of class
LocalisedBeanException, itsmessageis added as a line. - If the exception is another class, it is not included in the message string, but we keep on traversing.
To determine the cause:
- It finds the deep-most instance of
LocalisedBeanException, and considers its {#link getCause()} as the cause.
- Author:
- Owen Feehan
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description LocalisedBeanException(String message, Throwable cause)Create with a message and a cause. -
Method Summary
Modifier and Type Method Description protected booleancanExceptionBeCombined(Throwable exception)protected booleancanExceptionBeSkipped(Throwable exception)protected StringcreateMessageForDescription(String message)Throwablesummarize()BeanXMLExceptionsummarizeIgnoreIdenticalFilePath(Path pathMatch)If there is no nested-set of combinable exceptions, and themessagerelated to this current exception is identical as the passed parameter, then we simply ignore the current exception and promote itsThrowable.getCause().Methods inherited from class org.anchoranalysis.core.exception.combinable.AnchorCombinableException
combineDescriptionsRecursively, findMostDeepCombinableException, getDescription, hasNoCombinableNestedExceptionsMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
LocalisedBeanException
Create with a message and a cause.- Parameters:
message- the message.cause- the cause.
-
-
Method Details
-
canExceptionBeCombined
- Specified by:
canExceptionBeCombinedin classAnchorCombinableException
-
summarize
- Specified by:
summarizein classAnchorCombinableException
-
summarizeIgnoreIdenticalFilePath
If there is no nested-set of combinable exceptions, and themessagerelated to this current exception is identical as the passed parameter, then we simply ignore the current exception and promote itsThrowable.getCause().e.g. there's no point having two error lines e.g. indicating there's an error at file
SOMEPATH. It's only worthwhile doing this, if there's some extra information, like an include stack.- Parameters:
pathMatch- the path we ignored, if it's localized to the same file (and nowhere else).- Returns:
- a new exception representing a summary of this exception and its nested causes.
-
canExceptionBeSkipped
- Specified by:
canExceptionBeSkippedin classAnchorCombinableException
-
createMessageForDescription
- Specified by:
createMessageForDescriptionin classAnchorCombinableException
-