UNPKG

@daiso-tech/core

Version:

The library offers flexible, framework-agnostic solutions for modern web applications, built on adaptable components that integrate seamlessly with popular frameworks like Next Js.

63 lines (62 loc) 2.29 kB
/** * @module Cache */ import type { IFlexibleSerde, ISerializable } from "../../serde/contracts/_module-exports.js"; import { type ISerializedError, type OneOrMore } from "../../utilities/_module-exports.js"; /** * * IMPORT_PATH: `"@daiso-tech/core/cache/contracts"` * @group Errors */ export declare class CacheError extends Error implements ISerializable<ISerializedError> { static deserialize(deserializedValue: ISerializedError): CacheError; constructor(message: string, cause?: unknown); serialize(): ISerializedError; } /** * * IMPORT_PATH: `"@daiso-tech/core/cache/contracts"` * @group Errors */ export declare class UnexpectedCacheError extends CacheError implements ISerializable<ISerializedError> { static deserialize(deserializedValue: ISerializedError): CacheError; constructor(message: string, cause?: unknown); } /** * The error is thrown when attempting to increment or decrement a key that is not of number type. * * IMPORT_PATH: `"@daiso-tech/core/cache/contracts"` * @group Errors */ export declare class TypeCacheError extends CacheError implements ISerializable<ISerializedError> { static deserialize(deserializedValue: ISerializedError): CacheError; constructor(message: string, cause?: unknown); } /** * The error is thrown when a key is not found * * IMPORT_PATH: `"@daiso-tech/core/cache/contracts"` * @group Errors */ export declare class KeyNotFoundCacheError extends CacheError implements ISerializable<ISerializedError> { static deserialize(deserializedValue: ISerializedError): CacheError; constructor(message: string, cause?: unknown); } /** * * IMPORT_PATH: `"@daiso-tech/core/cache/contracts"` * @group Errors */ export declare const CACHE_ERRORS: { readonly Base: typeof CacheError; readonly Unexpected: typeof UnexpectedCacheError; readonly Type: typeof TypeCacheError; readonly KeyNotFound: typeof KeyNotFoundCacheError; }; /** * The `registerCacheErrorsToSerde` function registers all {@link ICache | `ICache`} related errors with `IFlexibleSerde`, ensuring they will properly be serialized and deserialized. * * IMPORT_PATH: `"@daiso-tech/core/cache/contracts"` * @group Errors */ export declare function registerCacheErrorsToSerde(serde: OneOrMore<IFlexibleSerde>): void;