Initial Commit
This commit is contained in:
37
packages/security-stack/security/vault/src/errors/codes.ts
Normal file
37
packages/security-stack/security/vault/src/errors/codes.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import { defineCodes } from "@suaveplan/error";
|
||||
|
||||
/**
|
||||
* Stable error code registry for `@suaveplan/vault`.
|
||||
*
|
||||
* Every code is namespaced under `VAULT.<MODULE>.<REASON>`. The full set is
|
||||
* frozen at module-load time and may never be removed without a major version
|
||||
* bump — consumer code MAY assert on these literal strings to drive recovery
|
||||
* logic (e.g. prompting the user to re-enter their password on
|
||||
* `VAULT.INVALID_CREDENTIALS`).
|
||||
*/
|
||||
export const VAULT_CODES = defineCodes("VAULT", [
|
||||
"LOCKED",
|
||||
"INVALID_CREDENTIALS",
|
||||
"ALREADY_OPEN",
|
||||
"NOT_INITIALIZED",
|
||||
"MANIFEST_INVALID",
|
||||
"MANIFEST_VERSION_UNSUPPORTED",
|
||||
"DECRYPT_FAILED",
|
||||
"ITEM.NOT_FOUND",
|
||||
"ITEM.VALIDATION_FAILED",
|
||||
"ITEM.VERSION_CONFLICT",
|
||||
"ATTACHMENT.NOT_FOUND",
|
||||
"ATTACHMENT.TOO_LARGE",
|
||||
"SHARE.NOT_FOUND",
|
||||
"SHARE.REVOKED",
|
||||
"SYNC.FAILED",
|
||||
"OPAQUE_HANDLE_INVALID",
|
||||
"DRIVE.FAILURE",
|
||||
] as const);
|
||||
|
||||
/**
|
||||
* Union of every fully-qualified error code emitted by `vault`. Use as the
|
||||
* type parameter of {@link import("./vault-error.js").VaultError} for
|
||||
* narrowed `code` checks.
|
||||
*/
|
||||
export type VaultErrorCode = (typeof VAULT_CODES)[keyof typeof VAULT_CODES];
|
||||
Reference in New Issue
Block a user