Preserve owning categories in public errors
This commit is contained in:
@@ -80,3 +80,12 @@ func TestMapPublicErrorDoesNotTreatRequestEncodingAsTransport(t *testing.T) {
|
||||
t.Fatalf("request encoding category = %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMapPublicErrorRetainsOwnerWithSpecializedCapacity(t *testing.T) {
|
||||
internal := &usecase.CapacityError{BackendID: "limited"}
|
||||
err := mapPublicError(&usecase.OperationError{Category: usecase.ErrLLMGenerate, Cause: internal})
|
||||
var capacity *CapacityError
|
||||
if !errors.Is(err, ErrLLMGenerate) || !errors.As(err, &capacity) || capacity.BackendID != "limited" || !errors.Is(err, ErrCapacityExceeded) {
|
||||
t.Fatalf("mapped owned capacity = %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user