// WriteErrorString is a convenience method for an error status with the actual error
321232
func (r *Response) WriteErrorString(httpStatus int, errorReason string) error {
	if r.err == nil {
		// if not called from WriteError
		r.err = errors.New(errorReason)
	}
	r.WriteHeader(httpStatus)
	if _, err := r.Write([]byte(errorReason)); err != nil {
		return err
	}
	return nil
}
2504
func ErrorString(w http.ResponseWriter, status int, code string, err error) {
	Error(w, status, types.NewErrorV1(code, err.Error()))
}
733501
func (a *Assertion) ErrorString(expr interface{}, str string, msg ...interface{}) *Assertion {
	ErrorString(a.t, expr, str, msg...)
	return a
}
571491
func (r *Response) WriteError(httpStatus int, err error) error {
	r.err = err
	return r.WriteErrorString(httpStatus, err.Error())
}
408507
func PrintError(w io.Writer, err error) {
	if list, ok := err.(ErrorList); ok {
		for _, e := range list {
			fmt.Fprintf(w, "%s\n", e)
		}
	} else if err != nil {
		fmt.Fprintf(w, "%s\n", err)
	}
}
953734
func (err Error) Error() string {
	if err.Path != "" {
		return err.Path + ": " + err.Err.Error()
	}
	return err.Err.Error()
}
777336
func writeError(c *routing.Context, err error) {
	if httpError, ok := err.(routing.HTTPError); ok {
		c.Response.WriteHeader(httpError.StatusCode())
	} else {
		c.Response.WriteHeader(http.StatusInternalServerError)
	}
	c.Write(err)
}
709350
func (h *NegotiationHandler) WriteError(w http.ResponseWriter, r *http.Request, err interface{}) {
	switch httputil.NegotiateContentType(r, []string{}, "application/json") {
	case "text/html":
		h.html.WriteError(w, r, err)
		return
	case "text/plain":
		h.plain.WriteError(w, r, err)
		return
	case "application/json":
		h.json.WriteError(w, r, err)
		return
	default:
		h.json.WriteError(w, r, err)
		return
	}
}
806484
func (e *ResponseError) Error() string {
	return fmt.Sprintf("%v %v: %d - %s",
		e.Response.Request.Method, e.Response.Request.URL,
		e.Response.StatusCode, e.errorMessage())
}
974148
func (e JSONCliError) Error() string {
	b, err := json.MarshalIndent(e.data, "", "  ")
	if err != nil {
		panic(err)
	}

	return string(b)
}
402271
func (a *Application) Errorf(format string, args ...interface{}) {
	fmt.Fprintf(a.errorWriter, a.Name+": error: "+format+"\n", args...)
}
1211463
func (e Errors) Error() string {
	ret := ""
	if len(e) > 0 {
		ret = fmt.Sprintf("Errors:\n")
		ret += strings.Join(e, "\n")
	}
	return ret
}
444908
func (err *errAssertionFailed) Error() string {
	return fmt.Sprintf("%s:\n%+v", err.msg, err.span)
}
1208861
func writeError(w http.ResponseWriter, statusCode int, msg string, args ...interface{}) {
	w.WriteHeader(statusCode)
	w.Write([]byte(fmt.Sprintf(msg, args...)))
}
353569
func Errorf(c web.C, rw http.ResponseWriter, code int, message string, args ...interface{}) {
	str := fmt.Sprintf(message, args...)
	ErrorString(c, rw, code, str)
}
630549
func (e *InvalidMarshalError) Error() string {
	return fmt.Sprintf("%s: %s", e.Code(), e.Message())
}
1151394
func (m MultiError) Error() string {
	errs := make([]string, len(m.Errors))
	for i, err := range m.Errors {
		errs[i] = err.Error()
	}

	return strings.Join(errs, "\n")
}