package prr

  1. Overview
  2. Docs

Error objects.

type enum = [
  1. | `Abort_error
  2. | `Constraint_error
  3. | `Data_clone_error
  4. | `Data_error
  5. | `Encoding_error
  6. | `Hierarchy_request_error
  7. | `Index_size_error
  8. | `Invalid_access_error
  9. | `Invalid_character_error
  10. | `Invalid_modification_error
  11. | `Invalid_node_type_error
  12. | `Invalid_state_error
  13. | `Namespace_error
  14. | `Network_error
  15. | `No_modification_allowed_error
  16. | `Not_allowed_error
  17. | `Not_found_error
  18. | `Not_readable_error
  19. | `Not_supported_error
  20. | `Operation_error
  21. | `Quota_exceeded_error
  22. | `Read_only_error
  23. | `Security_error
  24. | `Syntax_error
  25. | `Timeout_error
  26. | `Transaction_inactive_error
  27. | `Type_mismatch_error
  28. | `Url_mismatch_error
  29. | `Unknown_error
  30. | `Version_error
  31. | `Wrong_document_error
  32. | `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.

OCaml

Innovation. Community. Security.