Documentation ¶
Overview ¶
Package xerror implements helpers for errors
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Unwrap ¶
Unwrap if err is nil then it returns a valid value If err is not nil, Unwrap panics with err. Play: https://go.dev/play/p/w84d7Mb3Afk
Example ¶
result1 := Unwrap(strconv.Atoi("42")) fmt.Println(result1) _, err := strconv.Atoi("4o2") defer func() { v := recover() result2 := reflect.DeepEqual(err.Error(), v.(*strconv.NumError).Error()) fmt.Println(result2) }() Unwrap(strconv.Atoi("4o2"))
Output: 42 true
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.