Documentation
¶
Overview ¶
Package echo provides adapters for using err-envelope with Echo framework.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Trace ¶
func Trace(next echofw.HandlerFunc) echofw.HandlerFunc
Trace adapts err-envelope trace middleware to Echo's middleware interface.
This generates or propagates trace IDs and makes them available via errenvelope.TraceIDFromRequest(c.Request()).
Example:
e := echo.New()
e.Use(Trace)
e.GET("/user", func(c echo.Context) error {
traceID := errenvelope.TraceIDFromRequest(c.Request())
// ...
return nil
})
func Write ¶
Write sends a structured error response using err-envelope format.
This is a convenience wrapper that extracts c.Response().Writer and c.Request() to call errenvelope.Write.
Example:
e.GET("/user", func(c echo.Context) error {
if userID == "" {
return Write(c, errenvelope.BadRequest("Missing user ID"))
}
// ...
return nil
})
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.