31 lines
916 B
TypeScript
31 lines
916 B
TypeScript
import type { SuaveplanErrorOptions } from "@suaveplan/error";
|
|
import { defineCodes, SuaveplanError } from "@suaveplan/error";
|
|
|
|
export const CHUNKS_CODES = defineCodes("CHUNKS", [
|
|
"VERSION_UNSUPPORTED",
|
|
"METADATA_INVALID",
|
|
"SIG_INVALID",
|
|
"AEAD_TAG_INVALID",
|
|
"PAYLOAD_LEN_INVALID",
|
|
"FLAGS_RESERVED_NONZERO",
|
|
"MANIFEST_INVALID",
|
|
"MANIFEST_NOT_FOUND",
|
|
"FILE_NOT_FOUND",
|
|
"LAYOUT_INCOMPATIBLE",
|
|
"INGEST_FAILED",
|
|
"INLINE_SIG_INVALID",
|
|
] as const);
|
|
|
|
export type ChunksErrorCode = (typeof CHUNKS_CODES)[keyof typeof CHUNKS_CODES];
|
|
|
|
export class ChunksError extends SuaveplanError<ChunksErrorCode> {
|
|
// biome-ignore lint/complexity/noUselessConstructor: widens protected base constructor to public
|
|
public constructor(
|
|
code: ChunksErrorCode,
|
|
message: string,
|
|
options?: SuaveplanErrorOptions
|
|
) {
|
|
super(code, message, options);
|
|
}
|
|
}
|