This repository has been archived by the owner on Aug 30, 2023. It is now read-only.
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.
Open
Description
If I create a new HTTP handler like so:
fooHandler, err := handlers.NewFooHandler()
if err != nil {
log.Fatalf("Error: %s", err)
}
mux := http.NewServeMux()
mux.Handle("/foo/", raven.RecoveryHandler(fooHandler))
I get the following two exceptions:
cannot use fooHandler (type *handlers.SnsBounceHandler) as type func(http.ResponseWriter, *http.Request) in argument to raven.RecoveryHandler
cannot use raven.RecoveryHandler(snsBh) (type func(http.ResponseWriter, *http.Request)) as type http.Handler in argument to mux.Handle:
func(http.ResponseWriter, *http.Request) does not implement http.Handler (missing ServeHTTP method)
It looks like two things are occurring here:
- Custom objects that implement the
http.Handler
interface are not accepted in theraven.RecoveryHandler
function. - One cannot use the
raven.RecoverHandler
function withmux.Handle
becauseRecoveryHandler
returns a function handler instead of ahttp.Handle
object.
Metadata
Assignees
Labels
No labels