e.Use(func(h echo.HandlerFunc) echo.HandlerFunc {
  return func(c echo.Context) error {
    cc := c.(*CustomContext)
    return h(cc)
  }
})


e.HTTPErrorHandler = func(err error, c echo.Context) {
  cc := c.(*CustomContext)
}

I set custom HTTPErrorHandler and CustomContext.

I want to use CustomContext in HTTPErrorHandler.

c.Error(echo.NewHTTPError(http.StatusUnauthorized, "error"))

is work well.

echo.Context is *echo.context, not *CustomContext

Why occurred panic error when access not found page?