()
| 139 | } |
| 140 | |
| 141 | func ExampleTryUnwrap() { |
| 142 | result1 := TryUnwrap(strconv.Atoi("42")) |
| 143 | fmt.Println(result1) |
| 144 | |
| 145 | _, err := strconv.Atoi("4o2") |
| 146 | defer func() { |
| 147 | v := recover() |
| 148 | result2 := reflect.DeepEqual(err.Error(), v.(*strconv.NumError).Error()) |
| 149 | fmt.Println(result2) |
| 150 | }() |
| 151 | |
| 152 | TryUnwrap(strconv.Atoi("4o2")) |
| 153 | |
| 154 | // Output: |
| 155 | // 42 |
| 156 | // true |
| 157 | } |
| 158 | |
| 159 | func ExampleTryCatch() { |
| 160 | calledFinally := false |