//HandleError handle error from operation
HandleError handle error from operation
// HandleError handle error from operation
func handleError(s *client.Schemas, t func(http.ResponseWriter, *http.Request) (int, error)) http.Handler {
	return api.ApiHandler(s, http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
		if errorCode, err := t(rw, req); err != nil {
			logrus.Errorf("Got Error: %v", err)
			rw.Header().Set("Content-Type", "application/json")
			rw.WriteHeader(errorCode)
			e := model.Error{
				Resource: client.Resource{
					Type: "error",
				},
				Status:   errorCode,
				Msg:      err.Error(),
				BaseType: "error",
			}
			api.GetApiContext(req).Write(&e)
		}
	}))
}
func handleError ( s * client . Schemas , t func ( http . ResponseWriter , * http . Request ) ( int , error ) ) http . Handler { return api . ApiHandler ( s , http . HandlerFunc ( func ( rw http . ResponseWriter , req * http . Request ) { if errorCode , err := t ( rw , req ) ; err != nil { logrus . Errorf ( " " , err ) rw . Header ( ) . Set ( " " , " " ) rw . WriteHeader ( errorCode ) e := model . Error { Resource : client . Resource { Type : " " , } , Status : errorCode , Msg : err . Error ( ) , BaseType : " " , } api . GetApiContext ( req ) . Write ( & e ) } } ) ) }
HandleError handle error from operation
HandleError handle error from operation