Test_Extractor_Chain_Error_Propagation() — fiber Function Reference
Architecture documentation for the Test_Extractor_Chain_Error_Propagation() function in extractors_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD 8d47c3c2_3dbc_1f9c_0e0d_363aa1a59843["Test_Extractor_Chain_Error_Propagation()"] cf5e296e_8db5_6f84_b05a_9c0cac6f83e7["extractors_test.go"] 8d47c3c2_3dbc_1f9c_0e0d_363aa1a59843 -->|defined in| cf5e296e_8db5_6f84_b05a_9c0cac6f83e7 style 8d47c3c2_3dbc_1f9c_0e0d_363aa1a59843 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
extractors/extractors_test.go lines 364–398
func Test_Extractor_Chain_Error_Propagation(t *testing.T) {
t.Parallel()
app := fiber.New()
// Create extractors that return different errors
errorExtractor1 := Extractor{
Extract: func(_ fiber.Ctx) (string, error) {
return "", fiber.NewError(fiber.StatusBadRequest, "First error")
},
Key: "error1",
Source: SourceCustom,
}
errorExtractor2 := Extractor{
Extract: func(_ fiber.Ctx) (string, error) {
return "", fiber.NewError(fiber.StatusUnauthorized, "Second error")
},
Key: "error2",
Source: SourceCustom,
}
chainExtractor := Chain(errorExtractor1, errorExtractor2)
ctx := app.AcquireCtx(&fasthttp.RequestCtx{})
t.Cleanup(func() { app.ReleaseCtx(ctx) })
token, err := chainExtractor.Extract(ctx)
require.Empty(t, token)
require.Error(t, err)
require.Contains(t, err.Error(), "Second error") // Should return the last error
var fe *fiber.Error
require.ErrorAs(t, err, &fe)
require.Equal(t, fiber.StatusUnauthorized, fe.Code)
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does Test_Extractor_Chain_Error_Propagation() do?
Test_Extractor_Chain_Error_Propagation() is a function in the fiber codebase, defined in extractors/extractors_test.go.
Where is Test_Extractor_Chain_Error_Propagation() defined?
Test_Extractor_Chain_Error_Propagation() is defined in extractors/extractors_test.go at line 364.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free