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: IDEAS.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,8 @@
6
6
- Add `S.uint8Array` and `S.enableUint8Array`
7
7
- Updated `InvalidType` error code to include the received schema
8
8
- Updated internal representation of object schema - removed `items` fields. Updated internalt representation of tuple schema - `items` field is now an array of schemas instead of array of items. The `item` type is removed.
9
+
- Removed `Failed parsing/converting/asserting` when the error is at root
10
+
- Renamed `Failed parsing/converting/asserting at path` to `Failed at path`
**Sury** API explicitly tells you that it might throw an error. If you need you can catch it and perform `err instanceof S.Error` check. But **Sury** provides a convenient API which does it for you:
Copy file name to clipboardExpand all lines: docs/rescript-usage.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -676,7 +676,7 @@ let schema = S.object(_ => ())->S.strict
676
676
{
677
677
"someField": "value",
678
678
}->S.parseOrThrow(schema)
679
-
// throws S.error with the message: `Failed parsing: Unrecognized key "unknownKey"`
679
+
// throws S.error with the message: `Unrecognized key "unknownKey"`
680
680
```
681
681
682
682
By default **Sury** silently strips unrecognized keys when parsing objects. You can change the behaviour to disallow unrecognized keys with the `S.strict` function.
@@ -1037,7 +1037,7 @@ The `S.unknown` schema represents any data.
1037
1037
let schema = S.never
1038
1038
1039
1039
%raw(`undefined`)->S.parseOrThrow(schema)
1040
-
// throws S.error with the message: `Failed parsing: Expected never, received undefined`
1040
+
// throws S.error with the message: `Expected never, received undefined`
1041
1041
```
1042
1042
1043
1043
The `never` schema will fail parsing for every value.
0 commit comments