Skip to content

Commit 1b3f63a

Browse files
committed
remove typos
1 parent cd663df commit 1b3f63a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

markdown-pages/blog/release-12-0-0.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,10 @@ Note that `Result.getOrThrow` now throws a JavaScript exception, so please updat
197197

198198
We’ve renamed JS errors to `JsError.t` to better distinguish them from the `Result.Error` variant. Since JavaScript allows throwing anything (not only proper Error objects), the previous way of catching JS exceptions was unsafe:
199199

200-
```res
200+
```rescript
201201
let foo = switch myUnsafeJsResult() {
202202
| exception Exn.Error(e) => Error(e->Error.message)
203-
// ☝️ this will crash if `e` is undefined or null
203+
// ☝️ this will crash if `e` is undefined or null
204204
| myRes => Ok(myRes)
205205
}
206206
```
@@ -209,17 +209,17 @@ Additionally, the coexistence of `Result.Error` and the `Error` module caused co
209209

210210
The new recommended pattern is:
211211

212-
```res
212+
```rescript
213213
let foo = switch myUnsafeJsResult() {
214-
| exception JsExn(e) => Error(e->JsExn.message))
215-
// ☝️ this is now safe even `e` is undefined or null
214+
| exception JsExn(e) => Error(e->JsExn.message)
215+
// ☝️ this is now safe even if `e` is undefined or null
216216
| myRes => Ok(myRes)
217217
}
218218
```
219219

220220
Utility helpers for working with JS errors are now in `JsError`, eg:
221221

222-
```res
222+
```rescript
223223
JsError.throw(JsError.RangeError.make("the payload should be below 16"))
224224
```
225225

0 commit comments

Comments
 (0)