// SPDX-License-Identifier: GPL-3.0-or-later

package restic

import "errors"

// Common errors returned by the restic engine.
var (
	// ErrRepositoryExists is returned when trying to initialize an existing repository.
	ErrRepositoryExists = errors.New("repository already exists")

	// ErrRepositoryNotFound is returned when the repository doesn't exist.
	ErrRepositoryNotFound = errors.New("repository not found")

	// ErrRepositoryNotInitialized is returned when operating on an uninitialized repository.
	ErrRepositoryNotInitialized = errors.New("repository not initialized")

	// ErrSnapshotNotFound is returned when a snapshot doesn't exist.
	ErrSnapshotNotFound = errors.New("snapshot not found")

	// ErrInvalidPassword is returned when the repository password is incorrect.
	ErrInvalidPassword = errors.New("invalid repository password")

	// ErrLocked is returned when the repository is locked by another process.
	ErrLocked = errors.New("repository is locked")

	// ErrCanceled is returned when an operation was canceled.
	ErrCanceled = errors.New("operation canceled")

	// ErrRateLimited is returned when backup rate limit is exceeded (HTTP 429).
	// The client can only run one backup every 23 hours.
	ErrRateLimited = errors.New("backup rate limit exceeded")
)
