MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / TestHumaErrorConstructorEnvelope

Function TestHumaErrorConstructorEnvelope

internal/httpapi/errors_test.go:56–70  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

54}
55
56func TestHumaErrorConstructorEnvelope(t *testing.T) {
57 // The constructor installed as huma.NewError must yield our envelope so
58 // Huma's built-in validation errors render in the same shape.
59 se := humaErrorConstructor(http.StatusUnprocessableEntity, "validation failed")
60 env, ok := se.(*ErrorEnvelope)
61 if !ok {
62 t.Fatalf("expected *ErrorEnvelope, got %T", se)
63 }
64 if env.GetStatus() != http.StatusUnprocessableEntity {
65 t.Fatalf("status: %d", env.GetStatus())
66 }
67 if env.Code() != "unprocessable_entity" {
68 t.Fatalf("code: %q", env.Code())
69 }
70}

Callers

nothing calls this directly

Calls 3

humaErrorConstructorFunction · 0.85
GetStatusMethod · 0.80
CodeMethod · 0.80

Tested by

no test coverage detected