Class CodecException

All Implemented Interfaces:
Serializable

public class CodecException extends RuntimeException
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 Details

    • CodecException

      public CodecException(String message, Throwable cause)
      Creates a new CodecException with the given message and cause.
      Parameters:
      message - the error message
      cause - the underlying cause
  • Method Details

    • withField

      public CodecException withField(String fieldName)
      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

      public String getFieldPath()
      Returns the field path as a dot-separated string.
      Returns:
      the field path, or empty string if no path
    • getMessage

      public String getMessage()
      Overrides:
      getMessage in class Throwable