// IsAccessError verifies whether or not the cause for an error is an access error.
970572
func IsAccessError(err error) bool {
	cause := errors.Cause(err)
	if kvErr, ok := cause.(KeyValueError); ok && kvErr.KVError() {
		return kvErr.StatusCode() == int(gocbcore.StatusAccessError)
	}

	return false
}
175814
func isErrorAddressAlreadyInUse(err error) bool {
	errOpError, ok := err.(*net.OpError)
	if !ok {
		return false
	}
	errSyscallError, ok := errOpError.Err.(*os.SyscallError)
	if !ok {
		return false
	}
	errErrno, ok := errSyscallError.Err.(syscall.Errno)
	if !ok {
		return false
	}
	if errErrno == syscall.EADDRINUSE {
		return true
	}
	const WSAEADDRINUSE = 10048
	if runtime.GOOS == "windows" && errErrno == WSAEADDRINUSE {
		return true
	}
	return false
}
1342857
func IsEventError(err error) bool {
	switch err.(type) {
	case ErrInvalidFilterName, *ErrInvalidFilterName:
		return true
	case ErrFilterNamePrefix, *ErrFilterNamePrefix:
		return true
	case ErrFilterNameSuffix, *ErrFilterNameSuffix:
		return true
	case ErrInvalidFilterValue, *ErrInvalidFilterValue:
		return true
	case ErrDuplicateEventName, *ErrDuplicateEventName:
		return true
	case ErrUnsupportedConfiguration, *ErrUnsupportedConfiguration:
		return true
	case ErrDuplicateQueueConfiguration, *ErrDuplicateQueueConfiguration:
		return true
	case ErrUnknownRegion, *ErrUnknownRegion:
		return true
	case ErrARNNotFound, *ErrARNNotFound:
		return true
	case ErrInvalidARN, *ErrInvalidARN:
		return true
	case ErrInvalidEventName, *ErrInvalidEventName:
		return true
	}

	return false
}
903446
func IsExifError(err error) bool {
	if te, ok := err.(tiffErrors); ok {
		_, isExif := te[loadExif]
		return isExif
	}
	return false
}
1097351
func isAwsError(err error, code string) bool {
	if err, ok := err.(awserr.Error); ok && err.Code() == code {
		return true
	}
	return false
}
824015
func HandleCredentialError(isAuthError func(error) bool, err error, ctx context.ProviderCallContext) {
	MaybeHandleCredentialError(isAuthError, err, ctx)
}
297039
func (b accessPerms) isValidAccessPERM() bool {
	switch b {
	case accessNone, accessDownload, accessUpload, accessPublic:
		return true
	}
	return false
}
401628
func ValidateOfferAccess(access Access) error {
	switch access {
	case ReadAccess, ConsumeAccess, AdminAccess:
		return nil
	}
	return errors.NotValidf("%q offer access", access)
}
660710
func IsInteroperabilityError(err error) bool {
	if te, ok := err.(tiffErrors); ok {
		_, isInterop := te[loadInteroperability]
		return isInterop
	}
	return false
}
111813
func (e *Error) Is(ec *ErrorClass, opts ...EquivalenceOption) bool {
	return ec.Contains(e, opts...)
}
48259
func isAdmin(w http.ResponseWriter, r *http.Request) bool {
	log.Debug("validating admin")
	cookie, err := r.Cookie("scopes")
	if err == http.ErrNoCookie {
		writeErrorAuth(w, err)
		return false
	}
	if err != nil {
		writeErrorInternal(w, err)
		return false
	}
	scopes := strings.Fields(cookie.Value)
	for _, scope := range scopes {
		if scope == "admin" {
			// Confirm the admin permission has not been deleted
			// since the cookie was created by retrieving the
			// current value from the DB.
			cookie, err = r.Cookie("id")
			if err == http.ErrNoCookie {
				writeErrorAuth(w, err)
				return false
			}
			if err != nil {
				writeErrorInternal(w, err)
				return false
			}
			var admin bool
			q := `SELECT admin FROM users WHERE id=$1`
			if err = db.Get(&admin, q, cookie.Value); err != nil {
				writeErrorInternal(w, err)
				return false
			}
			if !admin {
				writeErrorAuth(w, errors.New("User is not an admin"))
				return false
			}
			log.Debug("validated admin")
			return true
		}
	}
	writeErrorAuth(w, errors.New("user is not an admin"))
	return false
}
474564
func IsStorageAttachedError(err error) bool {
	_, ok := errors.Cause(err).(storageAttachedError)
	return ok
}
829087
func isNoChildren(err error) bool {
	switch err := err.(type) {
	case syscall.Errno:
		if err == unix.ECHILD {
			return true
		}
	case *os.SyscallError:
		if err.Err == unix.ECHILD {
			return true
		}
	}
	return false
}
1226202
func (oauth *Oauth) CheckAccessToken(accessToken, openID string) (b bool, err error) {
	urlStr := fmt.Sprintf(checkAccessTokenURL, accessToken, openID)
	var response []byte
	response, err = util.HTTPGet(urlStr)
	if err != nil {
		return
	}
	var result util.CommonError
	err = json.Unmarshal(response, &result)
	if err != nil {
		return
	}
	if result.ErrCode != 0 {
		b = false
		return
	}
	b = true
	return
}
248420
func (a *Auth) IsAdmin(user User) bool {
	for _, a := range a.admins {
		if a == user.Name {
			return true
		}
	}

	return false
}
115671
func IsErrorCode(err error, c ErrorCode) bool {
	serr, ok := err.(Error)
	return ok && serr.ErrorCode == c
}
261812
func IsScopeMissingError(err error) bool {
	cause := errors.Cause(err)
	if kvErr, ok := cause.(KeyValueError); ok && kvErr.KVError() {
		return kvErr.StatusCode() == int(gocbcore.StatusScopeUnknown)
	}

	return false
}