ContractViolation indicates a critical mismatch between services where event data violates the receiving handler's contract. This represents a serious system issue where services are out of sync with their contracts. Common causes include:

  • Upstream services sending malformed data
  • Breaking changes in contracts without proper version management
  • Implicit assumptions in handlers not covered by contracts

Requires explicit handling as it signals potential system-wide contract violations.

Hierarchy

  • ViolationError<"Contract">
    • ContractViolation

Constructors

Properties

message: string
metadata: null | Record<string, any>

Additional structured data about the violation

name

The error name, formatted as ViolationError This helps with error identification in logs and stack traces

stack?: string
type

The specific type/category of the violation

prepareStackTrace?: ((err: Error, stackTraces: CallSite[]) => any)

Optional override for formatting stack traces

stackTraceLimit: number

Methods

  • Create .stack property on a target object

    Parameters

    • targetObject: object
    • OptionalconstructorOpt: Function

    Returns void