27
// Otherwise, the type name of the first non-wrapper error in the depth-first traversal of err's tree is returned.
28
// We consider errors wrapped via [fmt.Errorf], [errors.Join] and some pkg/errors functions to be wrapper errors.
30
>
// If any error in the tree has an explicit type name, use it, preferring the first one in the DFS traversal.
31
>
var typedErr typedError
32
>
if errors.As(err, &typedErr) {
33
return typedErr.ErrorTypeName()
34
}
35
36
// Special case for context.Cancel error. It is of type errorString, which is not very useful.
38
return "context.Canceled"
39
}