1
0

chore: refactor: error cause type.

This commit is contained in:
Jakub
2023-03-08 11:17:51 +01:00
parent 7cc2f3361d
commit d926dd3806
3 changed files with 12 additions and 3 deletions

View File

@ -17,7 +17,10 @@
package internal
import "errors"
import (
"errors"
"fmt"
)
// ErrCause returns the cause of the error, the inner-most error in the wrapped chain.
func ErrCause(err error) error {
@ -29,3 +32,7 @@ func ErrCause(err error) error {
return cause
}
func ErrCauseType(err error) string {
return fmt.Sprintf("%T", ErrCause(err))
}