Organize backend into product executable and shared Go modules

This commit is contained in:
Stephan D committed 2026-09-12 14:14:08 +02:00
1 parent 981e84a4b4
commit f0720ec66b
382 files changed
+1944 -6989

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
package merrors
import (
"errors"
"testing"
"time"
)
func TestWithThrottlePreservesClassificationAndDetails(t *testing.T) {
base := Define("verificationLimited")
err := Wrap(
WithThrottle(base, " destination ", 45*time.Second, "request is temporarily limited"),
"verification failed",
)
if !errors.Is(err, base) {
t.Fatalf("throttle error did not preserve classification: %v", err)
}
details, ok := ThrottleDetailsFrom(err)
if !ok {
t.Fatal("throttle details were not available through wrapping")
}
if details.ScopeKind != "destination" || details.RetryAfter != 45*time.Second {
t.Fatalf("unexpected throttle details: %+v", details)
}
if got, want := err.Error(), "verificationLimited: request is temporarily limited: verification failed"; got != want {
t.Fatalf("unexpected throttle error text: got=%q want=%q", got, want)
}
}
func TestThrottleDetailsFromRejectsUnannotatedError(t *testing.T) {
if details, ok := ThrottleDetailsFrom(ServiceUnavailable("dependency unavailable")); ok {
t.Fatalf("unexpected throttle details: %+v", details)
}
}