Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#### :bug: Bug fix

- Fix `Error.fromException`. https://github.com/rescript-lang/rescript/pull/7364
- Fix signature of `throw`. https://github.com/rescript-lang/rescript/pull/7365

#### :house: Internal

Expand Down
14 changes: 8 additions & 6 deletions runtime/Pervasives.res
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,18 @@ Raises the given exception, terminating execution unless caught by a surrounding
## Examples

```rescript
let error = Error.make("Everything is upside down.")
exception MyException(string)

if 5 > 10 {
throw(error)
} else {
Console.log("Phew, sanity still rules.")
let result = try {
throw(MyException("Out of milk"))
} catch {
| MyException(message) => "Caught exception: " ++ message
}

assertEqual(result, "Caught exception: Out of milk")
```
*/
external throw: Stdlib_Error.t => 'a = "%raise"
external throw: exn => 'a = "%raise"

/* Composition operators */

Expand Down