Class DomTripException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
eu.maveniverse.domtrip.DomTripException
- All Implemented Interfaces:
Serializable
Base exception class for all DomTrip-related errors.
DomTripException serves as the exception for all errors that can occur during XML processing with DomTrip. It extends RuntimeException to provide unchecked exception semantics, making the API easier to use while still allowing proper error handling when needed.
Usage Example:
try {
Editor editor = new Editor(malformedXml);
} catch (DomTripException e) {
// Handle any DomTrip-related error
logger.error("XML processing failed: " + e.getMessage(), e);
}
Error Recovery:
When catching DomTripException, consider:
- Checking the specific exception type for targeted handling
- Examining the cause for underlying issues
- Providing meaningful error messages to users
- Logging sufficient detail for debugging
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDomTripException(String message) Creates a new DomTripException with the specified message.DomTripException(String message, int position, String xmlContent) Creates a new DomTripException with the specified message.DomTripException(String message, Throwable cause) Creates a new DomTripException with the specified message and cause.DomTripException(Throwable cause) Creates a new DomTripException with the specified cause. -
Method Summary
Modifier and TypeMethodDescriptionintDeprecated.Deprecated.UsexmlContent()instead.intposition()Gets the character position where the parsing error occurred.Gets the XML content that was being parsed when the error occurred.Methods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
position
protected final int position -
xmlContent
-
-
Constructor Details
-
DomTripException
-
DomTripException
Creates a new DomTripException with the specified message.- Parameters:
message- the detail message explaining the error
-
DomTripException
-
DomTripException
Creates a new DomTripException with the specified cause.- Parameters:
cause- the underlying cause of this exception
-
-
Method Details
-
position
public int position()Gets the character position where the parsing error occurred.- Returns:
- the character position, or -1 if position is not available
-
getPosition
Deprecated.Useposition()instead.Gets the character position where the parsing error occurred.- Returns:
- the character position, or -1 if position is not available
-
xmlContent
Gets the XML content that was being parsed when the error occurred.This can be used to provide context around the error position for debugging purposes.
- Returns:
- the XML content, or null if not available
-
getXmlContent
Deprecated.UsexmlContent()instead.Gets the XML content that was being parsed when the error occurred.- Returns:
- the XML content, or null if not available
-
position()instead.