1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-09 23:22:28 +08:00

feat: add XError to support more contextual error handling

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

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