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.

53 lines (52 loc) 1.77 kB
/** * @module Codec */ import { type InferInstance } from "../../utilities/_module.js"; /** * The error occurs when a value is unable to be encoded. * * IMPORT_PATH: `"@daiso-tech/core/codec/contracts"` * @group Errors */ export declare class EncodingError extends Error { static create(error: unknown): EncodingError; /** * Note: Do not instantiate `EncodingError` directly via the constructor. Use the static `create()` factory method instead. * The constructor remains public only to maintain compatibility with errorPolicy types and prevent type errors. * @internal */ constructor(message: string, cause?: unknown); } /** * The error occurs when a value is unable to be decoded. * * IMPORT_PATH: `"@daiso-tech/core/codec/contracts"` * @group Errors */ export declare class DecodingError extends Error { static create(error: unknown): DecodingError; /** * Note: Do not instantiate `DecodingError` directly via the constructor. Use the static `create()` factory method instead. * The constructor remains public only to maintain compatibility with errorPolicy types and prevent type errors. * @internal */ constructor(message: string, cause?: unknown); } /** * IMPORT_PATH: `"@daiso-tech/core/codec/contracts"` * @group Errors */ export declare const CODEC_ERRORS: { readonly Encoding: typeof EncodingError; readonly Decoding: typeof DecodingError; }; /** * IMPORT_PATH: `"@daiso-tech/core/codec/contracts"` * @group Errors */ export type AllCodecErrors = InferInstance<(typeof CODEC_ERRORS)[keyof typeof CODEC_ERRORS]>; /** * IMPORT_PATH: `"@daiso-tech/core/codec/contracts"` * @group Errors */ export declare function isCodecError(value: unknown): value is AllCodecErrors;