Module Nuscrlib.Err

Error reporting

type user_error =
| UnknownPragma of string
| IncompatibleFlag of string * string
| MissingFlag of string * string
| PragmaNotSet of string * string
| LexerError of string
| ParserError of Loc.t
| UnboundRecursionName of Names.TypeVariableName.t
| RedefinedRecursionName of Names.TypeVariableName.t * Loc.t * Loc.t
| Uncategorised of string
| InvalidCommandLineParam of string
| UnboundRole of Names.RoleName.t
| ReflexiveMessage of Names.RoleName.t * Loc.t * Loc.t
| UnableToMerge of string
| RedefinedProtocol of Names.ProtocolName.t * Loc.t * Loc.t
| UnboundProtocol of Names.ProtocolName.t
| ArityMismatch of Names.ProtocolName.t * int * int
| InconsistentNestedChoice of Names.RoleName.t * Names.RoleName.t
| RoleMismatch of Names.RoleName.t * Names.RoleName.t
| DuplicateLabel of Names.LabelName.t
| DuplicateRoleArgs of Names.ProtocolName.t
| DuplicateRoleParams of Names.ProtocolName.t
| ChoiceCallRoleMismatch of Names.ProtocolName.t
| DuplicatePayloadField of Names.LabelName.t * Names.VariableName.t
| FileSysErr of string
| ProtocolNotFound of Names.ProtocolName.t
| IllFormedPayloadType of string
| TypeError of string * string
| UnknownVariableValue of Names.RoleName.t * Names.VariableName.t
| UnsatisfiableRefinement
| StuckRefinement
| 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 * Stdlib.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 * Stdlib.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:Stdlib.Lexing.position -> string -> 'a

Raise an Unimplemented error

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

Raise a violation, with a reason

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

Raise a violation, with a reason formatted using format strings