feat: add XError to support more contextual error handling

This commit is contained in:
dudaodong committed 2023-02-14 16:32:57 +08:00
1 parent 57bd64cae7
commit d0260b2841
4 files changed
+305 -12

No files matched your search

+3 -3
View File
@@ -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