func (srv *Server) handlerResponder(ft reflect.Type) func(p Params, outv []reflect.Value) {
	switch ft.NumOut() {
	case 0:
		// func(...)
		return func(Params, []reflect.Value) {}
	case 1:
		// func(...) error
		return func(p Params, outv []reflect.Value) {
			if err := outv[0].Interface(); err != nil {
				srv.WriteError(p.Context, p.Response, err.(error))
			}
		}
	case 2:
		// func(...) (ResultT, error)
		return func(p Params, outv []reflect.Value) {
			if err := outv[1].Interface(); err != nil {
				srv.WriteError(p.Context, p.Response, err.(error))
				return
			}
			if err := WriteJSON(p.Response, http.StatusOK, outv[0].Interface()); err != nil {
				srv.WriteError(p.Context, p.Response, err)
			}
		}
	default:
		panic("unreachable")
	}
}
// handlerResponder handles the marshaling of the result values from the call to a function
// of type ft. The returned function accepts the values returned by the handler.
handlerResponder handles the marshaling of the result values from the call to a function
of type ft. The returned function accepts the values returned by the handler.
// handlerResponder handles the marshaling of the result values from the call to a function // of type ft . The returned function accepts the values returned by the handler .
func (srv *Server) handlerResponder(ft reflect.Type) func(p Params, outv []reflect.Value) {
	switch ft.NumOut() {
	case 0:
		return func(Params, []reflect.Value) {}
	case 1:
		 error
		return func(p Params, outv []reflect.Value) {
			if err := outv[0].Interface(); err != nil {
				srv.WriteError(p.Context, p.Response, err.(error))
			}
		}
	case 2:
		 (ResultT, error)
		return func(p Params, outv []reflect.Value) {
			if err := outv[1].Interface(); err != nil {
				srv.WriteError(p.Context, p.Response, err.(error))
				return
			}
			if err := WriteJSON(p.Response, http.StatusOK, outv[0].Interface()); err != nil {
				srv.WriteError(p.Context, p.Response, err)
			}
		}
	default:
		panic("unreachable")
	}
}
func ( srv * Server ) handlerResponder ( ft reflect . Type ) func ( p Params , outv [ ] reflect . Value ) { switch ft . NumOut ( ) { case 0 : return func ( Params , [ ] reflect . Value ) { } case 1 : return func ( p Params , outv [ ] reflect . Value ) { if err := outv [ 0 ] . Interface ( ) ; err != nil { srv . WriteError ( p . Context , p . Response , err . ( error ) ) } } case 2 : return func ( p Params , outv [ ] reflect . Value ) { if err := outv [ 1 ] . Interface ( ) ; err != nil { srv . WriteError ( p . Context , p . Response , err . ( error ) ) return } if err := WriteJSON ( p . Response , http . StatusOK , outv [ 0 ] . Interface ( ) ) ; err != nil { srv . WriteError ( p . Context , p . Response , err ) } } default : panic ( " " ) } }
handlerResponder handles the marshaling of the result values from the call to a function
of type ft.
handlerResponder handles the marshaling of the result values from the call to a function of type ft .
// func(...) // func(...) error // func(...) (ResultT, error)