Module Jv.Error

Error objects.

type enum = [
| `Abort_error
| `Constraint_error
| `Data_clone_error
| `Data_error
| `Encoding_error
| `Hierarchy_request_error
| `Index_size_error
| `Invalid_access_error
| `Invalid_character_error
| `Invalid_modification_error
| `Invalid_node_type_error
| `Invalid_state_error
| `Namespace_error
| `Network_error
| `No_modification_allowed_error
| `Not_allowed_error
| `Not_found_error
| `Not_readable_error
| `Not_supported_error
| `Operation_error
| `Quota_exceeded_error
| `Read_only_error
| `Security_error
| `Syntax_error
| `Timeout_error
| `Transaction_inactive_error
| `Type_mismatch_error
| `Url_mismatch_error
| `Unknown_error
| `Version_error
| `Wrong_document_error
| `Other

If not listed. Do not match on this !

]

The type for a selection of DOMException error names. Do not match on `Other if your error is not listed, use a catch all _ branch and consult name. This makes sure you code will work correctly if new cases are added in the future.

type t

The type for Error objects.

val v : ?⁠name:Jstr.t -> Jstr.t -> t

v ~name msg is an error with message msg and name name (defaults to "Error").

Properties

val name : t -> Jstr.t

name e is the exception name as a string.

val enum : t -> enum

enum e is name e parsed into the enum type.

val message : t -> Jstr.t

msg exn is the exception message as a string.

val stack : t -> Jstr.t

stack v is the stack trace as a string. This includes name and message.