Skip to content

Fix signature of throw #7365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 31, 2025
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