Files
deepseek-harness/packages/storage/storage/src/error.ts
T
imccyu e90b0d51df feat(storage): storage hub with named backend registry and data-form mounts
ctx.storage is a pure registration hub: multiple named backends stay
mounted side by side, data forms (domain first) mount via the
merge-extensible StorageForms map. src/backend.ts is the normative
KV-facet contract; tests/contract.ts is the shared conformance suite
every backend runs. Backends expose data-shape facets (kv now, an
append-log facet reserved for the future session-backend migration).
2026-07-25 11:08:04 +08:00

36 lines
934 B
TypeScript

/**
* Error vocabulary for the storage hub and its backends.
* @module @deepseek-ai/dsh-storage/src/error
*/
/** Discriminant codes carried by every {@link StorageError}. */
export type StorageErrorCode =
| 'backend-not-found'
| 'form-not-mounted'
| 'duplicate-backend'
| 'duplicate-mount'
| 'version-mismatch'
| 'malformed-medium'
| 'closed'
/**
* Error thrown by the hub and by backend implementations. The `code` is the
* stable contract consumers may switch on; `message` is diagnostic prose.
*/
export class StorageError extends Error {
override readonly name = 'StorageError'
/**
* @param code - Stable discriminant for the failure class.
* @param message - Human-readable diagnostic detail.
* @param options - Standard error options (`cause`).
*/
constructor(
readonly code: StorageErrorCode,
message: string,
options?: ErrorOptions,
) {
super(message, options)
}
}