mirror of
https://github.com/SagerNet/sing.git
synced 2025-04-05 04:47:40 +03:00
20 lines
266 B
Go
20 lines
266 B
Go
package exceptions
|
|
|
|
type HasInnerError interface {
|
|
Unwrap() error
|
|
}
|
|
|
|
func Unwrap(err error) error {
|
|
for {
|
|
inner, ok := err.(HasInnerError)
|
|
if !ok {
|
|
break
|
|
}
|
|
innerErr := inner.Unwrap()
|
|
if innerErr == nil {
|
|
break
|
|
}
|
|
err = innerErr
|
|
}
|
|
return err
|
|
}
|