[nostalgia/developer-handbook] Update notes on error handling
All checks were successful
Build / build (push) Successful in 2m31s
All checks were successful
Build / build (push) Successful in 2m31s
This commit is contained in:
parent
fbe2fcd32a
commit
07ecbde112
@ -227,6 +227,14 @@ int caller5(int i) {
|
|||||||
int caller6(int i) {
|
int caller6(int i) {
|
||||||
return foo(i).unwrapThrow(); // unwrap will throw if there is an error
|
return foo(i).unwrapThrow(); // unwrap will throw if there is an error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int caller7(int i) {
|
||||||
|
return foo(i).or_value(0); // will return 0 if foo returned an error
|
||||||
|
}
|
||||||
|
|
||||||
|
ox::Result<uint64_t> caller8(int i) {
|
||||||
|
return foo(i).to<uint64_t>(); // will convert the result of foo to uint64_t
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Lastly, there are a few macros available to help in passing ```ox::Error```s
|
Lastly, there are a few macros available to help in passing ```ox::Error```s
|
||||||
|
Loading…
Reference in New Issue
Block a user