package nuscr

  1. Overview
  2. Docs

Error reporting

type user_error =
  1. | UnknownPragma of string
  2. | IncompatibleFlag of string * string
  3. | MissingFlag of string * string
  4. | PragmaNotSet of string * string
  5. | LexerError of string
  6. | ParserError of Loc.t
  7. | UnboundRecursionName of Names.TypeVariableName.t
  8. | RedefinedRecursionName of Names.TypeVariableName.t * Loc.t * Loc.t
  9. | Uncategorised of string
  10. | InvalidCommandLineParam of string
  11. | UnboundRole of Names.RoleName.t
  12. | ReflexiveMessage of Names.RoleName.t * Loc.t * Loc.t
  13. | UnableToMerge of string
  14. | RedefinedProtocol of Names.ProtocolName.t * Loc.t * Loc.t
  15. | UnboundProtocol of Names.ProtocolName.t
  16. | ArityMismatch of Names.ProtocolName.t * int * int
  17. | InconsistentNestedChoice of Names.RoleName.t * Names.RoleName.t
  18. | RoleMismatch of Names.RoleName.t * Names.RoleName.t
  19. | DuplicateLabel of Names.LabelName.t
  20. | DuplicateRoleArgs of Names.ProtocolName.t
  21. | DuplicateRoleParams of Names.ProtocolName.t
  22. | ChoiceCallRoleMismatch of Names.ProtocolName.t
  23. | DuplicatePayloadField of Names.LabelName.t * Names.VariableName.t
  24. | FileSysErr of string
  25. | ProtocolNotFound of Names.ProtocolName.t
  26. | IllFormedPayloadType of string
  27. | TypeError of string * string
  28. | UnknownVariableValue of Names.RoleName.t * Names.VariableName.t
  29. | UnsatisfiableRefinement
  30. | StuckRefinement
  31. | UnguardedTypeVariable of Names.TypeVariableName.t

A user error is an error found in the protocols

val sexp_of_user_error : user_error -> Sexplib0.Sexp.t
exception UserError of user_error

UserError is a user error and should be reported back so it can be fixed

val show_user_error : user_error -> string
exception Violation of string * Lexing.position

A Violation is reported when an impossible state was reached. It has to be considered a bug even when the fix is to change the Violation to a user error

exception UnImplemented of string * Lexing.position

An Unimplemented is reported when certain features are not implemented, the string attached provides a description of the feature missing.

Shortcuts for raising exceptions

val uerr : user_error -> 'a

Raise an user error

val unimpl : here:Lexing.position -> string -> 'a

Raise an Unimplemented error

val violation : here:Lexing.position -> string -> 'a

Raise a violation, with a reason

val violationf : here:Lexing.position -> ('a, unit, string, 'b) format4 -> 'a

Raise a violation, with a reason formatted using format strings

OCaml

Innovation. Community. Security.