# Xerror Package xerror implements helpers for errors.
## Source: - [https://github.com/duke-git/lancet/blob/main/xerror/xerror.go](https://github.com/duke-git/lancet/blob/main/xerror/xerror.go)
## Usage: ```go import ( "github.com/duke-git/lancet/v2/xerror" ) ```
## Index - [Unwrap](#Unwrap)
## Documentation ### Unwrap

Unwrap if err is nil then it returns a valid value. If err is not nil, Unwrap panics with err.

Signature: ```go func Unwrap[T any](val T, err error) T ``` Example: ```go package main import ( "fmt" "github.com/duke-git/lancet/v2/xerror" ) func main() { _, err := strconv.Atoi("4o2") defer func() { v := recover() fmt.Println(err.Error()) // err.Error() == v.(*strconv.NumError).Error() }() xerror.Unwrap(strconv.Atoi("4o2")) } ```