Files
tubestation/browser/components/backup/BackupConstants.mjs
Stephen Thompson ad5c1d8ebf Bug 1906169 - Error plumbing for profile backup web worker r=backup-reviewers,mconley
Some of the Firefox profile backup code is executed within a web worker, so errors thrown in the worker do not automatically maintain their full context when caught in the main process.

This change creates a BackupError for throwing errors with causes specific to Firefox profile backup. The new error type is configured to work with the PromiseWorker machinery in the Firefox codebase in order to serialize and deserialize error details across the worker boundary.

Differential Revision: https://phabricator.services.mozilla.com/D215920
2024-07-08 17:49:45 +00:00

45 lines
1.5 KiB
JavaScript

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
export const ERRORS = Object.freeze({
/** User is not authorized to restore a backup archive */
UNAUTHORIZED: 1,
/** Selected backup archive can't be restored because it is corrupt */
CORRUPTED_ARCHIVE: 2,
/**
* Selected backup archive can't be restored because the backup manifest
* version is too old, from the future, or invalid
*/
UNSUPPORTED_BACKUP_VERSION: 3,
/** Backup service was not started or is not running */
UNINITIALIZED: 4,
/** Could not read from or write to the file system */
FILE_SYSTEM_ERROR: 5,
/** Encryption of backup archive failed */
ENCRYPTION_FAILED: 6,
/** Decryption of backup archive failed */
DECRYPTION_FAILED: 7,
/** Recovery of backup failed without a more specific cause */
RECOVERY_FAILED: 8,
/** Unknown error with backup system without a more specific cause */
UNKNOWN: 9,
/**
* Backup system tried to enable backup encryption but it was
* already enabled
*/
ENCRYPTION_ALREADY_ENABLED: 10,
/**
* Backup system tried to disable backup encryption but it was
* already disabled
*/
ENCRYPTION_ALREADY_DISABLED: 10,
/** User supplied a new password that is not a valid password */
INVALID_PASSWORD: 12,
/**
* An error internal to the code that is likely caused by a bug
* or other programmer error.
*/
INTERNAL_ERROR: 13,
});