Package com.tnsai.parser
Class ParseException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.tnsai.exceptions.TnsAIException
com.tnsai.parser.ParseException
- All Implemented Interfaces:
Serializable
Exception thrown when LLM output cannot be parsed into the expected type.
Contains the raw output and error details to help diagnose parsing issues and potentially retry with error correction.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionParseException(String message) Creates a new parse exception.ParseException(String message, String rawOutput) ParseException(String message, String rawOutput, String expectedFormat) Creates a new parse exception with expected format.ParseException(String message, String rawOutput, Throwable cause) Creates a new parse exception with a cause. -
Method Summary
Modifier and TypeMethodDescriptionGets the expected format description if available.Gets the raw output that failed to parse.getTruncatedRawOutput(int maxLength) Creates a truncated version of the raw output for logging.toString()Methods inherited from class com.tnsai.exceptions.TnsAIException
getContext, getErrorCode, getMaxRetryAttempts, getMessage, getSuggestedRetryDelayMs, getThrownAt, isRetryable, wrapMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
Constructor Details
-
ParseException
Creates a new parse exception.- Parameters:
message- the error messagerawOutput- the raw output that failed to parse
-
ParseException
-
ParseException
Creates a new parse exception with expected format.- Parameters:
message- the error messagerawOutput- the raw output that failed to parseexpectedFormat- description of expected format
-
ParseException
Creates a new parse exception with a cause.- Parameters:
message- the error messagerawOutput- the raw output that failed to parsecause- the underlying cause
-
-
Method Details
-
getRawOutput
Gets the raw output that failed to parse.- Returns:
- the raw output
-
getExpectedFormat
Gets the expected format description if available.- Returns:
- expected format or null
-
getTruncatedRawOutput
Creates a truncated version of the raw output for logging.- Parameters:
maxLength- maximum length- Returns:
- truncated raw output
-
toString
-