Class DecodeException

All Implemented Interfaces:
Serializable

public class DecodeException extends BadRequestException
A request body that is missing, malformed or does not match the requested type (400). Codecs report only a safe code and, when known, the declared property path; parser messages and input fragments are never carried.
See Also:
  • Constructor Details

    • DecodeException

      public DecodeException(String code)
      Creates the exception without a field.
      Parameters:
      code - safe machine-readable code, for example malformed_body
    • DecodeException

      public DecodeException(String code, String field)
      Creates the exception for a property path.
      Parameters:
      code - safe machine-readable code, for example type_mismatch
      field - declared property path, or null when unknown
      Throws:
      IllegalArgumentException - if the field is not a safe property path
  • Method Details

    • field

      public Optional<String> field()
      Returns the property path that failed, when known.
      Returns:
      property path
    • violations

      public List<Violation> violations()
      Returns one violation for the field, or none.
      Overrides:
      violations in class AxiomException
      Returns:
      immutable violations