Skip to content

Commit 3e07d26

Browse files
cknittfhammerschmidt
authored andcommitted
Fix signature of throw (#7365)
1 parent 19f2d0f commit 3e07d26

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#### :bug: Bug fix
1616

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

1920
#### :house: Internal
2021

runtime/Pervasives.res

+8-6
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,18 @@ Raises the given exception, terminating execution unless caught by a surrounding
2323
## Examples
2424
2525
```rescript
26-
let error = Error.make("Everything is upside down.")
26+
exception MyException(string)
2727
28-
if 5 > 10 {
29-
throw(error)
30-
} else {
31-
Console.log("Phew, sanity still rules.")
28+
let result = try {
29+
throw(MyException("Out of milk"))
30+
} catch {
31+
| MyException(message) => "Caught exception: " ++ message
3232
}
33+
34+
assertEqual(result, "Caught exception: Out of milk")
3335
```
3436
*/
35-
external throw: Stdlib_Error.t => 'a = "%raise"
37+
external throw: exn => 'a = "%raise"
3638

3739
/* Composition operators */
3840

0 commit comments

Comments
 (0)