expose source error classification

This commit is contained in:
Dmitry Sergeev
2026-08-27 00:17:40 +03:00
parent a7fcf12740
commit c9f237d9f1
2 changed files with 7 additions and 5 deletions
+3 -1
View File
@@ -31,7 +31,9 @@ func (e *SourceError) Unwrap() error {
return e.Err
}
func errorKind(err error) ErrorKind {
// KindOf returns the source error category contained in err.
// It returns ErrorKindUnknown when err has no SourceError in its chain.
func KindOf(err error) ErrorKind {
var sourceErr *SourceError
if errors.As(err, &sourceErr) {
return sourceErr.Kind