update readm

This commit is contained in:
Anton Nesterov 2024-10-17 06:08:22 +02:00
parent e9a11515ad
commit b56dcd0639
No known key found for this signature in database
GPG key ID: 59121E8AE2851FB5

View file

@ -4,16 +4,16 @@ Simplified result/error handling for JavaScript.
Grip always returns a consistent call result ready to be handled.
It makes the control flow similar to that of Golang, but doesn't force you to make additional null checks or create transitional variables to hold error results.
Instead of returning an nullish Error, Grip always returns a Status object:
Instead of returning a nullish error, Grip always returns a consistent status object:
```javascript
const [value, status] = grip(callable)
if (status.Fail()) {
// handle any error
}
if (status.Of(MySpecificError)) {
// handle specific error
}
if (status.Fail()) {
// handle any error
}
```
The call result is better than tuple: