Module Trading_engine.Diagnostic

Stable structured errors for process and file boundaries.

val version : string
type code =
  1. | Cli_invalid_arguments
  2. | Input_io
  3. | Scenario_invalid_json
  4. | Scenario_invalid
  5. | Scenario_unsupported_contract
  6. | Scenario_stream_invalid
  7. | Scenario_stream_changed
  8. | Resource_limit
  9. | Replay_failed
  10. | Reducer_failed
  11. | Strategy_invalid_configuration
  12. | Strategy_protocol
  13. | Strategy_timeout
  14. | Strategy_process
  15. | Strategy_exit
  16. | Artifact_exists
  17. | Artifact_io
  18. | Artifact_state
type phase =
  1. | Cli
  2. | Input
  3. | Validation
  4. | Replay
  5. | Reducer
  6. | Strategy
  7. | Artifact
type cause = private {
  1. kind : string;
  2. message : string;
  3. operation : string option;
  4. target : string option;
}
type context = private {
  1. json_path : string option;
  2. line : int option;
  3. sequence : int64 option;
  4. event_id : string option;
  5. order_id : string option;
  6. causation_ids : string list;
}
type t = private {
  1. code : code;
  2. phase : phase;
  3. message : string;
  4. context : context;
  5. cause : cause option;
}
val cause_of_exception : exn -> cause
val make : ?json_path:string -> ?line:int -> ?sequence:int64 -> ?event_id:string -> ?order_id:string -> ?causation_ids:string list -> ?cause:cause -> code:code -> phase:phase -> string -> t
val of_exception : ?json_path:string -> ?line:int -> ?sequence:int64 -> code:code -> phase:phase -> message:string -> exn -> t
val annotate : ?json_path:string -> ?line:int -> ?sequence:int64 -> ?event_id:string -> ?order_id:string -> ?causation_ids:string list -> t -> t
val combine : t -> t -> t

combine primary secondary preserves the primary identity and context while adding the secondary message and an underlying cause when needed.

val code_to_string : code -> string
val phase_to_string : phase -> string
val to_yojson : t -> Yojson.Safe.t
val to_json : t -> string
val to_human : t -> string
val pp : t Fmt.t