The only thing i can find in the documation is below:
Can we construct a value with type exn? Where is the definition of exn?
The only thing i can find in the documation is below:
You can define your own constructors, and then use them to create a value of type exn:
exception MyExnConstructor(string)
// NOTE: usually you should use raise()
// in conjunction with an exception constructor.
// Like so: raise(MyExnConstructor("test"))
// Otherwise in the JavaScript output you
// wont get a stack trace attached to the exception object.
let myExn: exn = MyExnConstructor("test")
There’re also some predefined exceptions like Not_found
or Invalid_argument
. I couldn’t find a list in ReScript documentation, but here’s a list for OCaml: OCaml - The core library
Also, any module that you use might define its own exceptions.
More docs: Exception | ReScript Language Manual