UNPKG

@decaf-ts/core

Version:

Core persistence module for the decaf framework

28 lines (27 loc) 974 B
import { InternalError } from "@decaf-ts/db-decorators"; /** * @description Error thrown when an unsupported operation is attempted * @summary This error is thrown when an operation is requested that is not supported by the current * persistence adapter or configuration. It extends the BaseError class and sets a 500 status code. * @param {string|Error} msg - The error message or an Error object to wrap * @class UnsupportedError * @example * ```typescript * // Throwing an UnsupportedError * if (!adapter.supportsTransactions()) { * throw new UnsupportedError('Transactions are not supported by this adapter'); * } * * // Catching an UnsupportedError * try { * await adapter.beginTransaction(); * } catch (error) { * if (error instanceof UnsupportedError) { * console.error('Operation not supported:', error.message); * } * } * ``` */ export declare class UnsupportedError extends InternalError { constructor(msg: string | Error); }