Module Modelkit.Error

Structured failures for public machine learning operations.

Routine data, validation, numerical, convergence, compatibility, and artifact failures use this type. Exceptions are reserved for programmer defects such as violating a documented bounds precondition.

type context =
  1. | Stage of string
  2. | Fold of int
  3. | Candidate of int
  4. | Feature of Feature_name.t
type kind =
  1. | Data of Data_error.t
  2. | Shape_mismatch of {
    1. name : string;
    2. expected : int list;
    3. observed : int list;
    }
  3. | Feature_schema_mismatch of {
    1. expected : Feature_schema.t;
    2. observed : Feature_schema.t;
    }
  4. | Validation of {
    1. name : string;
    2. reason : string;
    }
  5. | Numerical of {
    1. operation : string;
    2. reason : string;
    }
  6. | Convergence of {
    1. algorithm : string;
    2. reason : string;
    }
  7. | Compatibility of {
    1. component : string;
    2. reason : string;
    }
  8. | Artifact of {
    1. operation : string;
    2. reason : string;
    }
  9. | Callback_failure of {
    1. reason : string;
    }
  10. | Cancelled
type t
val make : ?context:context list -> remediation:string -> kind -> t
val of_data_error : ?context:context list -> remediation:string -> Data_error.t -> t
val kind : t -> kind
val context : t -> context list
val remediation : t -> string
val with_context : context -> t -> t

with_context outer error records outer before existing context.

val pp : Format.formatter -> t -> unit
val to_string : t -> string