/*
ErrorWithCauseChain formats err and all its causes if it's an *Err, else returns
err.Error().
*/
199716
func ErrorWithCauseChain(err error) string {
	var buffer bytes.Buffer

	for {
		if wrappedErr, ok := err.(*Err); ok && wrappedErr.Cause != nil {
			fmt.Fprintln(&buffer, wrappedErr.Error())
			fmt.Fprint(&buffer, "caused by ")
			err = wrappedErr.Cause
		} else {
			break
		}
	}

	if err != nil {
		buffer.WriteString(err.Error())
	} else {
		buffer.WriteString("<err=nil>")
	}

	return buffer.String()
}
994870
func (logger *Logger) WithError(err error) *Entry {
	entry := logger.newEntry()
	defer logger.releaseEntry(entry)
	return entry.WithError(err)
}
496082
func formatError(err error) string {
	if err, ok := err.(kerrs.Aggregate); ok {
		var errorStrings []string
		for _, err := range err.Errors() {
			errorStrings = append(errorStrings, err.Error())
		}
		return strings.Join(errorStrings, "\n")
	}

	return err.Error()
}
464327
func (c CompletionCode) Error() string {
	if s, ok := completionCodes[c]; ok {
		return s
	}
	return fmt.Sprintf("Completion Code: %X", uint8(c))
}
265703
func (err *Error) Error() string {
	return fmt.Sprintf("%s: %s", err.Err, err.Msg)
}
382676
func (m URLs) WithError(err *probe.Error) URLs {
	m.Error = err
	return m
}
29643
func (v *Error) Error() string {
	return fmt.Sprintf("%s: %s", v.Field, v.ErrorBody())
}
1087291
func Error(err error) *string {
	if err == nil {
		return nil
	}
	str := err.Error()
	return &str
}
81604
func (d *ulReqDecoder) error(format string, a ...interface{}) {
	msg := fmt.Sprintf(
		"pkt-line %d: %s", d.nLine,
		fmt.Sprintf(format, a...),
	)

	d.err = NewErrUnexpectedData(msg, d.line)
}
390501
func (c *Client) UseError(fn context.HandlerFunc) *Client {
	c.Middleware.UseError(fn)
	return c
}
715055
func (r *Result) withError(err error) *Result {
	r.err = err
	return r
}
632969
func (c *causeT) Error() string {
	var buf bytes.Buffer
	buf.WriteString(c.msg)
	c.ctx.writeToBuf(&buf)
	buf.WriteString(": ")
	buf.WriteString(c.cause.Error())
	return buf.String()
}
869811
func (e DiskCacheTooFullForBlockError) Error() string {
	return fmt.Sprintf(
		"Disk cache too full for block %s requested with action %s",
		e.Ptr, e.Action)
}
1095092
func (qse QingStorError) Error() string {
	return fmt.Sprintf(
		"QingStor Error: StatusCode \"%d\", Code \"%s\", Message \"%s\", Request ID \"%s\", Reference URL \"%s\"",
		qse.StatusCode, qse.Code, qse.Message, qse.RequestID, qse.ReferenceURL)
}
815366
func Error(format string, v ...interface{}) {
	log.Error(fmt.Sprintf(format, v...))
}
464857
func (k *authKeepAliver) Error() error {
	k.RLock()
	defer k.RUnlock()
	return k.err
}
940651
func (err *Error) Error() string {
	return fmt.Sprintf("[Error]:%v: %v %v - %v %v",
		err.StatusCode, err.Method, err.URL, err.ErrorCode, err.Reason)
}