// ErrorHandler is a functional argument that sets error handler of the server
965008
func ErrorHandler(h utils.ErrorHandler) Option {
	return func(t *Tracer) error {
		t.errHandler = h
		return nil
	}
}
127613
func HandleError(h httpx.Handler, f ErrorHandlerFunc) *Error {
	e := NewError(h)
	e.ErrorHandler = f
	return e
}
1021000
func WithErrorHandler(value fab.ErrorHandler) coptions.Opt {
	return func(p coptions.Params) {
		logger.Debugf("Checking errHandlerSetter")
		if setter, ok := p.(errHandlerSetter); ok {
			logger.Debugf("... setting error handler")
			setter.SetErrorHandler(value)
		}
	}
}
1256703
func (nc *Conn) SetErrorHandler(cb ErrHandler) {
	if nc == nil {
		return
	}
	nc.mu.Lock()
	defer nc.mu.Unlock()
	nc.Opts.AsyncErrorCB = cb
}
1355795
func ErrorResponseHandler(request *restful.Request, response *restful.Response, origin error, err *ErrorResponse) {
	fields := log.Fields{
		"Internal":    err.Err[0].InternalError,
		"Description": err.Err[0].Msg,
		"Context":     err.Err[0].Context,
		"URL":         request.Request.URL.String(),
		"Method":      request.Request.Method,
	}

	for k, vs := range request.Request.Form {
		var out string
		for i, v := range vs {
			if i > 0 {
				out += ","
			}
			out += v
		}
		fields[k] = out
	}
	log.WithFields(fields).Error(origin)

	if response != nil {
		response.WriteHeaderAndEntity(err.Err[0].Code, err)
	}
}
540982
func StatusHandler(w http.ResponseWriter, r *http.Request) {
	if r.Method == "GET" {
		checks := CheckStatus()
		status := http.StatusOK

		// If there is an error, return 503
		if len(checks) != 0 {
			status = http.StatusServiceUnavailable
		}

		statusResponse(w, r, status, checks)
	} else {
		http.NotFound(w, r)
	}
}
548520
func errHandler(err error) handlerFunc {
	return func(w http.ResponseWriter, r *http.Request) error {
		return err
	}
}
1001407
func goErrorHandler(code C.int, reason *C.char) {
	reasonHeader := reflect.StringHeader{
		Data: uintptr(unsafe.Pointer(reason)),
		Len:  int(C.strlen(reason)),
	}
	reasonString := (*string)(unsafe.Pointer(&reasonHeader))
	Log.Printf("%s -- %s", codeToString(int(code)), *reasonString)
}
929077
func (r *Request) UseHandler(phase string, fn context.HandlerFunc) *Request {
	r.Middleware.UseHandler(phase, fn)
	return r
}
328059
func ErrorLoggerT(typ ErrorType) HandlerFunc {
	return func(c *Context) {
		c.Next()
		errors := c.Errors.ByType(typ)
		if len(errors) > 0 {
			c.JSON(-1, errors)
		}
	}
}
43842
func ServerError(w http.ResponseWriter, r *http.Request, err error) {
	handlerMu.RLock()
	f, ok := handlerMap[http.StatusInternalServerError]
	handlerMu.RUnlock()
	if ok {
		r = ctxSetErr(r, err)
		f.ServeHTTP(w, r)
	} else {
		defaultServerError(w, r, err)
	}
}
75340
func Handler(h StatusHandlerFunc) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		status, response := h(w, r)
		w.WriteHeader(status)
		if response == nil {
			return
		}

		Responder(w, r, response)
	}
}
234635
func (app *Application) Error(statusCode int, handler ErrorHandlerFunc) {
	app.errorHandler[statusCode] = handler
}
1074257
func (s *Server) HTTPHandler() http.Handler {
	s.mu.Lock()
	defer s.mu.Unlock()
	return s.httpHandler
}
349332
func (b *Base) SetErrorHandler(eh ErrorHandler) error {
	if eh == nil {
		return errors.New("error handler must be non-nil")
	}

	b.mutex.Lock()
	defer b.mutex.Unlock()
	b.errHandler = eh

	return nil
}
983220
func (statics *AssestStruct) HttpHandler(pdir string) http.Handler {
	return &_assestFileServer{sf: statics, pdir: pdir}
}
428138
func (hook *SentryHook) AddErrorHandler(fn func(entry *logrus.Entry, err error)) {
	hook.errorHandlers = append(hook.errorHandlers, fn)
}