You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,7 @@
4
4
5
5
- BREAKING: Use new native `bigint` type. This requires ReScript compiler version "11.1.0-rc.6" or higher. https://github.com/rescript-association/rescript-core/pull/207
6
6
-`Int`, `Float`, `BigInt`: use optional args and deprecate `xxxWithRadix`, `xxxWithPrecision` etc. https://github.com/rescript-association/rescript-core/pull/209
7
+
- BREAKING: Add optional `~message: string=?` to `Option.getExn`. This also changes the error raised by `Option.getExn` from `Not_found` to a regular JS error. https://github.com/rescript-association/rescript-core/pull/212
`getExn(opt)` returns `value` if `opt` is `Some(value)`, otherwise raises an exception.
69
+
`getExn(opt, ~message=?)` returns `value` if `opt` is `Some(value)`, otherwise raises an exception with the message provided, or a generic message if no message was provided.
70
70
71
71
```rescript
72
72
Option.getExn(Some(3)) // 3
73
73
Option.getExn(None) /* Raises an Error */
74
+
Option.getExn(None, ~message="was None!") /* Raises an Error with the message "was None!" */
74
75
```
75
76
76
77
## Exceptions
77
78
78
79
- Raises an error if `opt` is `None`
79
80
*/
80
-
letgetExn: option<'a> =>'a
81
+
letgetExn: (option<'a>, ~message: string=?)=>'a
81
82
82
83
/**
83
84
`getUnsafe(opt)` returns `value` if `opt` is `Some(value)`, otherwise `undefined`.
0 commit comments