// IsError is a helper function which is needed to have ability to check that
// returned error has specific error code.
487279
func IsError(e interface{}, codes ...errorCode) bool {
	err, ok := e.(*routerError)
	if !ok {
		return false
	}

	for _, code := range codes {
		if err.code == code {
			return true
		}
	}

	return false
}
1180563
func InnerError(err error) error {
	contained, ok := err.(ContainedError)
	if !ok {
		return nil
	}
	return contained.InnerError()
}
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)
}
818782
func (e *ErrorClass) Is(parent *ErrorClass) bool {
	for check := e; check != nil; check = check.parent {
		if check == parent {
			return true
		}
	}
	return false
}
1081469
func IsConfigurationError(err error) bool {
	switch errType := errors.Cause(err).(type) {
	case ConfigurationError:
		return errType.ConfigurationError()
	default:
		return false
	}
}
956462
func hasError(err error, fns ...utilerrors.Matcher) bool {
	if err == nil {
		return false
	}
	if agg, ok := err.(utilerrors.Aggregate); ok {
		for _, err := range agg.Errors() {
			if hasError(err, fns...) {
				return true
			}
		}
		return false
	}
	for _, fn := range fns {
		if fn(err) {
			return true
		}
	}
	return false
}
511065
func (e *Etcd) IsNameError(err error) bool {
	if ee, ok := err.(etcdc.Error); ok && ee.Code == etcdc.ErrorCodeKeyNotFound {
		return true
	}
	return false
}
953734
func (err Error) Error() string {
	if err.Path != "" {
		return err.Path + ": " + err.Err.Error()
	}
	return err.Err.Error()
}
848874
func (e Error) Error() string {
	if e.Err != nil {
		return e.Desc + ": " + e.Err.Error()
	}
	return e.Desc
}
344362
func IsRedirectError(err error) bool {
	_, ok := errors.Cause(err).(*RedirectError)
	return ok
}
412473
func IsErr(err error, errs ...error) bool {
	for _, exactErr := range errs {
		if err == exactErr {
			return true
		}
	}
	return false
}
621772
func IsCloseError(err error, codes ...int) bool {
	if e, ok := err.(*CloseError); ok {
		for _, code := range codes {
			if e.Code == code {
				return true
			}
		}
	}
	return false
}
769859
func (e *InvalidValidationError) Error() string {

	if e.Type == nil {
		return "validator: (nil)"
	}

	return "validator: (nil " + e.Type.String() + ")"
}
1235543
func (m *MultiError) Error() string {
	m.mutex.Lock()
	defer m.mutex.Unlock()

	formattedError := make([]string, len(m.errs))
	for i, e := range m.errs {
		formattedError[i] = e.Error()
	}

	return strings.Join(formattedError, ", ")
}
476438
func (r Response) IsUserError() bool {
	return r.Err != nil && isUserError(r.Err)
}
226624
func IsErrnoFn(err error, fn func(error) bool) bool {
	if err == nil {
		return false
	}
	if err, ok := err.(*OpError); ok {
		return fn(err.Errno)
	}
	return fn(err)
}
329958
func (errs Errors) Error() string {
	var errors = []string{}
	for _, e := range errs {
		errors = append(errors, e.Error())
	}
	return strings.Join(errors, "; ")
}