Package eu.maveniverse.domtrip
Class DomTripException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- eu.maveniverse.domtrip.DomTripException
-
- All Implemented Interfaces:
java.io.Serializable
public class DomTripException extends java.lang.RuntimeExceptionBase 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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected intpositionprotected java.lang.StringxmlContent
-
Constructor Summary
Constructors Constructor Description DomTripException(java.lang.String message)Creates a new DomTripException with the specified message.DomTripException(java.lang.String message, int position, java.lang.String xmlContent)Creates a new DomTripException with the specified message.DomTripException(java.lang.String message, java.lang.Throwable cause)Creates a new DomTripException with the specified message and cause.DomTripException(java.lang.Throwable cause)Creates a new DomTripException with the specified cause.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description intgetPosition()Deprecated.Useposition()instead.java.lang.StringgetXmlContent()Deprecated.UsexmlContent()instead.intposition()Gets the character position where the parsing error occurred.java.lang.StringxmlContent()Gets the XML content that was being parsed when the error occurred.
-
-
-
Constructor Detail
-
DomTripException
public DomTripException(java.lang.String message, int position, java.lang.String xmlContent)Creates a new DomTripException with the specified message.- Parameters:
message- the detail message explaining the error
-
DomTripException
public DomTripException(java.lang.String message)
Creates a new DomTripException with the specified message.- Parameters:
message- the detail message explaining the error
-
DomTripException
public DomTripException(java.lang.String message, java.lang.Throwable cause)Creates a new DomTripException with the specified message and cause.- Parameters:
message- the detail message explaining the errorcause- the underlying cause of this exception
-
DomTripException
public DomTripException(java.lang.Throwable cause)
Creates a new DomTripException with the specified cause.- Parameters:
cause- the underlying cause of this exception
-
-
Method Detail
-
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 public int 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
public java.lang.String 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 public java.lang.String 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
-
-