// AddErrorHandler adds a error handler function used when Sentry returns error.
428138
func (hook *SentryHook) AddErrorHandler(fn func(entry *logrus.Entry, err error)) {
	hook.errorHandlers = append(hook.errorHandlers, fn)
}
1286822
func ErrorHandler(eh ErrorHandlerFunc) func(*Configuration) error {
	return func(c *Configuration) error {
		c.errorHandler = eh
		return nil
	}
}
432339
func DefaultErrorHandler(w http.ResponseWriter, r *http.Request, err error) {
	panic(err)
}
745909
func (h *compoundHandler) HandleError(err error) (bool, error) {
	for _, handler := range h.handlers {
		handled, handleErr := handler.HandleError(err)
		if handled || handleErr != nil {
			return handled, handleErr
		}
	}

	return false, nil
}
390501
func (c *Client) UseError(fn context.HandlerFunc) *Client {
	c.Middleware.UseError(fn)
	return c
}
362608
func (r *Router) handleError(c *Context, err error) {
	if httpError, ok := err.(HTTPError); ok {
		c.Error(httpError.Error(), httpError.StatusCode())
	} else {
		c.Error(err.Error(), http.StatusInternalServerError)
	}
}
353039
func (c *BuildConfigController) handleError(err error, key interface{}) {
	if err == nil {
		c.queue.Forget(key)
		return
	}

	if IsFatal(err) {
		klog.V(2).Infof("Will not retry fatal error for key %v: %v", key, err)
		c.queue.Forget(key)
		return
	}

	if c.queue.NumRequeues(key) < maxRetries {
		klog.V(4).Infof("Retrying key %v: %v", key, err)
		c.queue.AddRateLimited(key)
		return
	}

	klog.V(2).Infof("Giving up retrying %v: %v", key, err)
	c.queue.Forget(key)
}
421970
func (t *ReturnError) AddError(err error) {
	if err == nil {
		return
	}
	t.Error = errutil.NewErrorsSkip(1, err, t.Error)
	if t.Status == 0 {
		t.Status = 404
	}
}
521804
func defaultErrorHandler(ctx *Context, data ...map[string]interface{}) {
	var renderData map[string]interface{}
	if len(data) == 0 {
		renderData = make(map[string]interface{})
		renderData["Code"] = ctx.statusCode
		renderData["Title"] = http.StatusText(ctx.statusCode)
		renderData["Message"] = http.StatusText(ctx.statusCode)
	} else {
		renderData = data[0]
	}
	if _, ok := renderData["Code"]; !ok {
		renderData["Code"] = ctx.statusCode
	}
	if _, ok := renderData["Title"]; !ok {
		renderData["Title"] = http.StatusText(ctx.statusCode)
	}
	if _, ok := renderData["Message"]; !ok {
		renderData["Message"] = http.StatusText(ctx.statusCode)
	}
	httpRequest, _ := httputil.DumpRequest(ctx.Request, true)
	renderData["HTTPRequest"] = string(httpRequest)
	var buf bytes.Buffer
	tmpl.Parse(errorTemplate)
	tmpl.Execute(&buf, renderData)
	ctx.Send(&buf)
}
54958
func HandlerErrorLogger(logger log.Logger) HandlerOption {
	return func(h *Handler) { h.errorHandler = transport.NewLogErrorHandler(logger) }
}
383718
func ErrorHandler(h utils.ErrorHandler) ConnLimitOption {
	return func(cl *ConnLimiter) error {
		cl.errHandler = h
		return nil
	}
}
903045
func (l *Logger) SetErrorHandler(h func(error) error) {
	l.errorHandler.Store(h)
}
1015423
func (r *Reporter) AddErr(err error) bool {
	if err == nil {
		return false
	}

	if stackErr, ok := err.(StackError); ok {
		r.addStack(stackErr.Stack())
	} else {
		r.mu.Lock()
		r.wrapper = r.wrapper.AppendErr(err)
		r.mu.Unlock()
	}

	return true
}
933666
func (c *Cursor) handleError(err error) error {
	c.mu.Lock()
	defer c.mu.Unlock()

	return c.handleErrorLocked(err)
}
1272963
func AddError(ch *Changeset, field string, message string) {
	ch.errors = append(ch.errors, errors.New(message, field, errors.Changeset))
}
325477
func (hm *handlerManager) AddInvokeHandler(handler ...InvokeHandler) {
	if len(handler) == 0 {
		return
	}
	hm.invokeHandlers = append(hm.invokeHandlers, handler...)
	next := hm.defaultInvokeHandler
	for i := len(hm.invokeHandlers) - 1; i >= 0; i-- {
		next = getNextInvokeHandler(next, hm.invokeHandlers[i])
	}
	hm.invokeHandler = next
}
841578
func ErrorHandler(c *router.Context, err error) {
	code := grpcutil.Code(err)
	switch code {
	case codes.Unauthenticated:
		loginURL, err := auth.LoginURL(c.Context, c.Request.URL.RequestURI())
		if err == nil {
			http.Redirect(c.Writer, c.Request, loginURL, http.StatusFound)
			return
		}
		errors.Log(
			c.Context, errors.Annotate(err, "Failed to retrieve login URL").Err())
	case codes.OK:
		// All good.
	default:
		errors.Log(c.Context, err)
	}

	status := grpcutil.CodeStatus(code)
	c.Writer.WriteHeader(status)
	templates.MustRender(c.Context, c.Writer, "pages/error.html", templates.Args{
		"Code":    status,
		"Message": err.Error(),
	})
}