mirror of
https://github.com/duke-git/lancet.git
synced 2026-11-16 05:12:11 +08:00
feat: add XError to support more contextual error handling
This commit is contained in:
1 parent
57bd64cae7
commit
d0260b2841
4 files changed
+305
-12
No files matched your search
@@ -6,8 +6,8 @@ import (
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func ExampleUnwrap() {
|
||||
result1 := Unwrap(strconv.Atoi("42"))
|
||||
func ExampleTryUnwrap() {
|
||||
result1 := TryUnwrap(strconv.Atoi("42"))
|
||||
fmt.Println(result1)
|
||||
|
||||
_, err := strconv.Atoi("4o2")
|
||||
@@ -17,7 +17,7 @@ func ExampleUnwrap() {
|
||||
fmt.Println(result2)
|
||||
}()
|
||||
|
||||
Unwrap(strconv.Atoi("4o2"))
|
||||
TryUnwrap(strconv.Atoi("4o2"))
|
||||
|
||||
// Output:
|
||||
// 42
|
||||
|
||||
Reference in new issue
Block a user