mirror of
https://github.com/kataras/iris.git
synced 2025-12-18 02:17:05 +00:00
Upgrade to new go errors and some minor fixes and improvements including easier debugging of invalid routes and e.t.c.
Former-commit-id: 5809157b952ccc61a67a9861470774b3a6fee024
This commit is contained in:
@@ -1,20 +1,12 @@
|
||||
package handlerconv
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/kataras/iris/context"
|
||||
"github.com/kataras/iris/core/errors"
|
||||
)
|
||||
|
||||
var errHandler = errors.New(`
|
||||
Passed argument is not a func(context.Context) neither one of these types:
|
||||
- http.Handler
|
||||
- func(w http.ResponseWriter, r *http.Request)
|
||||
- func(w http.ResponseWriter, r *http.Request, next http.HandlerFunc)
|
||||
---------------------------------------------------------------------
|
||||
It seems to be a %T points to: %v`)
|
||||
|
||||
// FromStd converts native http.Handler & http.HandlerFunc to context.Handler.
|
||||
//
|
||||
// Supported form types:
|
||||
@@ -63,7 +55,13 @@ func FromStd(handler interface{}) context.Handler {
|
||||
//
|
||||
// No valid handler passed
|
||||
//
|
||||
panic(errHandler.Format(handler, handler))
|
||||
panic(fmt.Errorf(`
|
||||
Passed argument is not a func(context.Context) neither one of these types:
|
||||
- http.Handler
|
||||
- func(w http.ResponseWriter, r *http.Request)
|
||||
- func(w http.ResponseWriter, r *http.Request, next http.HandlerFunc)
|
||||
---------------------------------------------------------------------
|
||||
It seems to be a %T points to: %v`, handler, handler))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user