Package io.bytestreams.codec.core
Class CodecException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
io.bytestreams.codec.core.CodecException
- All Implemented Interfaces:
Serializable
Exception thrown when encoding or decoding fails.
This exception accumulates field path information as it propagates through nested codecs,
providing clear error messages like: field [order.customer.name]: End of stream reached
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCodecException(String message, Throwable cause) Creates a new CodecException with the given message and cause. -
Method Summary
Modifier and TypeMethodDescriptionReturns the field path as a dot-separated string.Creates a new CodecException with the field name prepended to the path.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
CodecException
Creates a new CodecException with the given message and cause.- Parameters:
message- the error messagecause- the underlying cause
-
-
Method Details
-
withField
Creates a new CodecException with the field name prepended to the path.- Parameters:
fieldName- the field name to prepend- Returns:
- a new CodecException with the updated field path
-
getFieldPath
Returns the field path as a dot-separated string.- Returns:
- the field path, or empty string if no path
-
getMessage
- Overrides:
getMessagein classThrowable
-