// ToError receives an error and mutates it into an Error based on the concrete
// type of the Error.
11210
func ToError(err error) HTTPError {
	switch e := err.(type) {
	case *Error:
		return e
	case HTTPError:
		if et, ok := errors.TypeForStatusCode(e.StatusCode()); ok {
			return NewError(et, e.Error())
		}
	}

	return NewError(errors.InternalServerError, "Internal Server Error")
}
264438
func (c *requestContext) err(e error, msg string, args ...interface{}) {
	code := 0
	switch {
	case e == nil:
		panic("nil")
	case tq.Retry.In(e):
		code = 409
	case transient.Tag.In(e):
		code = 500
	default:
		code = 202 // fatal error, don't need a redelivery
	}
	args = append(args, e)
	c.fail(code, msg+" - %s", args...)
}
840803
func (e *RunError) Error() string {
	return fmt.Sprintf("%s: %s", e.Command.Path, e.ExecError)
}
804163
func (response *Response) Err() error {
	if len(response.Errors) > 0 {
		return response.Errors[0]
	}
	return nil
}
904088
func (err *ErrSession) Error() string {
	if err.Err == nil {
		return fmt.Sprintf("%s (%s)", stateTexts[err.State], err.Type)
	}
	return fmt.Sprintf("%s: %s (%s)", stateTexts[err.State], err.Err, err.Type)
}
31148
func (worker *Worker) err(e error) {
	if worker.ErrorHandler != nil {
		worker.ErrorHandler(e)
	}
}
713911
func CheckError(t T, err error) bool {
	if err != nil {
		logerror(t, serrorf("CheckError: did not expect to receive err: %v", err))
	}
	return err != nil
}
870145
func (l *List) Err() error {
	if len(l.errs) == 0 {
		return nil
	}

	if l.err != nil {
		switch len(l.errs) {
		case 1:
			l.err = l.errs[0]

		default:
			var sb strings.Builder
			sb.WriteString(l.errs[0].Error())
			for _, err := range l.errs[1:] {
				sb.WriteRune('\n')
				sb.WriteString(err.Error())
			}
			l.err = errors.New(sb.String())
		}
	}

	return l.err
}
844363
func (l *Logger) Err(err error) *Event {
	if err != nil {
		return l.Error().Err(err)
	} else {
		return l.Info()
	}
}
1239864
func Error(v ...interface{}) {
	if std.Level >= ErrorLevel {
		std.Logger.Print(ErrorLevel.String() + fmt.Sprint(v...))
	}
}
86246
func (s *Status) Err() error {
	if s.Code() == codes.OK {
		return nil
	}
	return (*statusError)(s.s)
}
75028
func (r *rudimentaryErrorBackoff) OnError(error) {
	r.lastErrorTimeLock.Lock()
	defer r.lastErrorTimeLock.Unlock()
	d := time.Since(r.lastErrorTime)
	if d < r.minPeriod {
		// If the time moves backwards for any reason, do nothing
		time.Sleep(r.minPeriod - d)
	}
	r.lastErrorTime = time.Now()
}
991838
func (o *TextOutput) Err(msg string) {
	if o.enabled {
		fmt.Fprintf(os.Stderr, o.DarkRed(msg)+"\n")
	}
}
613993
func (i *Iterator) Error() error {
	if i.err == io.EOF {
		return nil
	}
	return i.err
}
452778
func NewErrorTypeMatcher(t ErrorType) utilerrors.Matcher {
	return func(err error) bool {
		if e, ok := err.(*Error); ok {
			return e.Type == t
		}
		return false
	}
}
832169
func (z *Tokenizer) Err() error {
	if z.tt != ErrorToken {
		return nil
	}
	return z.err
}
289802
func (c *Completion) Err() error {
	c.lock.Lock()
	defer c.lock.Unlock()
	return c.err
}