// IsRecoverable returns true if error is a RecoverableError with
// Recoverable=true. Otherwise false is returned.
511666
func IsRecoverable(e error) bool {
	if re, ok := e.(Recoverable); ok {
		return re.IsRecoverable()
	}
	return false
}
660710
func IsInteroperabilityError(err error) bool {
	if te, ok := err.(tiffErrors); ok {
		_, isInterop := te[loadInteroperability]
		return isInterop
	}
	return false
}
304133
func IsUpdateable(ctx context.Context) error {
	fn, err := executable(ctx)
	if err != nil {
		return err
	}
	out.Debug(ctx, "isUpdateable - File: %s", fn)
	// check if this is a test binary
	if strings.HasSuffix(filepath.Base(fn), ".test") {
		return nil
	}

	// check if we want to force updateability
	if uf := os.Getenv("GOPASS_FORCE_UPDATE"); uf != "" {
		out.Debug(ctx, "updateable due to force flag")
		return nil
	}

	// check if file is in GOPATH
	if gp := os.Getenv("GOPATH"); strings.HasPrefix(fn, gp) {
		return fmt.Errorf("use go get -u to update binary in GOPATH")
	}

	// check file
	fi, err := os.Stat(fn)
	if err != nil {
		return err
	}
	if !fi.Mode().IsRegular() {
		return fmt.Errorf("not a regular file")
	}
	if err := unix.Access(fn, unix.W_OK); err != nil {
		return err
	}

	// check dir
	fdir := filepath.Dir(fn)
	return unix.Access(fdir, unix.W_OK)
}
107612
func IsRetryableError(err error) bool {
	if err == nil {
		return false
	}

	if ErrRetryable.Equal(err) ||
		ErrLockConflict.Equal(err) ||
		ErrConditionNotMatch.Equal(err) ||
		// TiKV exception message will tell you if you should retry or not
		strings.Contains(err.Error(), "try again later") {
		return true
	}

	return false
}
153801
func (mock *Mock) IsProcessable(file string) bool {
	items := mock.getReturnValues("IsProcessable")
	return items[0].(bool)
}
373043
func RetryIfPossible(ctx context.Context, g *libkb.GlobalContext, post func(ctx context.Context, attempt int) error) (err error) {
	defer g.CTraceTimed(ctx, "RetryIfPossible", func() error { return err })()
	const nRetries = 3
	for i := 0; i < nRetries; i++ {
		g.Log.CDebugf(ctx, "| RetryIfPossible(%v)", i)
		err = post(ctx, i)
		if isSigOldSeqnoError(err) {
			g.Log.CDebugf(ctx, "| retrying due to SigOldSeqnoError", i)
			continue
		}
		if isStaleBoxError(err) {
			g.Log.CDebugf(ctx, "| retrying due to StaleBoxError", i)
			continue
		}
		return err
	}
	g.Log.CDebugf(ctx, "| RetryIfPossible exhausted attempts")
	if err == nil {
		// Should never happen
		return fmt.Errorf("failed retryable team operation")
	}
	// Return the error from the final round
	return err
}
367820
func IsDurabilityError(err error) bool {
	switch errType := errors.Cause(err).(type) {
	case DurabilityError:
		return errType.DurabilityError()
	default:
		return false
	}
}
732778
func IsErrorRetryable(err error) bool {
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			return isCodeRetryable(aerr.Code()) || isNestedErrorRetryable(aerr)
		}
	}
	return false
}
939345
func (r *recorder) IsEnabled() bool {
	r.mu.Lock()
	defer r.mu.Unlock()
	return r.enabled
}
1034100
func Safe(fn func(), r Recovery) {
	defer func() {
		if e := recover(); e != nil {
			handlePanic(r, e)
		}
	}()
	fn()
}
1022767
func isS3CodeRetryable(s3Code string) (ok bool) {
	_, ok = retryableS3Codes[s3Code]
	return ok
}
451647
func (o *object) isActionable() error {
	if o.c.Cancelled() {
		return ErrCancellerCancelled
	} else if o.IsDestroyed() {
		return ErrObjectDestroyed
	}
	return nil
}
1136803
func isIgnorableError(rootless bool, err error) bool {
	// We do not ignore errors if we are root.
	if !rootless {
		return false
	}
	// Is it an ordinary EPERM?
	if os.IsPermission(errors.Cause(err)) {
		return true
	}

	// Try to handle other errnos.
	var errno error
	switch err := errors.Cause(err).(type) {
	case *os.PathError:
		errno = err.Err
	case *os.LinkError:
		errno = err.Err
	case *os.SyscallError:
		errno = err.Err
	}
	return errno == unix.EROFS || errno == unix.EPERM || errno == unix.EACCES
}
13737
func onRecover(e interface{}, info string) (err Error) {
	if e != nil {
		switch {
		case isSystemError(e):
			return e.(Error)
		case isGenericError(e):
			return newSystemErrorWithCause(info, e.(error))
		default:
			return newSystemErrorf(info+" - recovered: %s", e)
		}
	}
	return nil
}
1021227
func copyRetryable(old superAgentRetryable) superAgentRetryable {
	newRetryable := old
	newRetryable.RetryableStatus = make([]int, len(old.RetryableStatus))
	for i := range old.RetryableStatus {
		newRetryable.RetryableStatus[i] = old.RetryableStatus[i]
	}
	return newRetryable
}
9980
func (o *order) IsReturnable(amount int64) error {
	if o.Status != orderpb.Order_Paid && o.Status != orderpb.Order_Fulfilled && o.Status != orderpb.Order_Canceled {
		return status.Error(codes.Internal, "Order is not paid or fulfilled.")
	}
	// if refund amount is bigger than the order amount return err
	if amount > o.GetAmount() {
		return status.Error(codes.Internal, "Refund amount is greater then order amount.")
	}
	return nil
}
57837
func isHTTPReqErrorRetryable(err error) bool {
	if err == nil {
		return false
	}
	switch e := err.(type) {
	case *url.Error:
		switch e.Err.(type) {
		case *net.DNSError, *net.OpError, net.UnknownNetworkError:
			return true
		}
		if strings.Contains(err.Error(), "Connection closed by foreign host") {
			return true
		} else if strings.Contains(err.Error(), "net/http: TLS handshake timeout") {
			// If error is - tlsHandshakeTimeoutError, retry.
			return true
		} else if strings.Contains(err.Error(), "i/o timeout") {
			// If error is - tcp timeoutError, retry.
			return true
		} else if strings.Contains(err.Error(), "connection timed out") {
			// If err is a net.Dial timeout, retry.
			return true
		} else if strings.Contains(err.Error(), "net/http: HTTP/1.x transport connection broken") {
			// If error is transport connection broken, retry.
			return true
		}
	}
	return false
}