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
+4 -4
View File
@@ -6,12 +6,12 @@ import (
"testing"
)
func TestErrorKindThroughWrapping(t *testing.T) {
func TestKindOfThroughWrapping(t *testing.T) {
base := errors.New("producer disappeared")
wrapped := wrapError("read video", ErrorKindUnavailable, base)
outer := fmt.Errorf("worker failed: %w", wrapped)
if got := errorKind(outer); got != ErrorKindUnavailable {
if got := KindOf(outer); got != ErrorKindUnavailable {
t.Fatalf("errorKind() = %v, want %v", got, ErrorKindUnavailable)
}
if !errors.Is(outer, base) {
@@ -22,8 +22,8 @@ func TestErrorKindThroughWrapping(t *testing.T) {
}
}
func TestErrorKindUnknown(t *testing.T) {
if got := errorKind(errors.New("ordinary error")); got != ErrorKindUnknown {
func TestKindOfUnknown(t *testing.T) {
if got := KindOf(errors.New("ordinary error")); got != ErrorKindUnknown {
t.Fatalf("errorKind() = %v, want %v", got, ErrorKindUnknown)
}
}