Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/Aquaticat/Monochromatic. TypeScript and Rust monorepo: Claude Code and Pi coding-agent plugins, a m
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200/** Memoization and decoration errors thrown by the p-memoize fork. Every class extends `TypeError` to keep the rejection shapes upstream `p-memoize` callers already handle (`instanceof TypeError` keeps holding) and carries upstream's message text verbatim. @module */
//region Cache clearing errors
/** Thrown by `pMemoizeClear` when the given function was never memoized. @example ```ts import { NotMemoizedError, pMemoizeClear, } from '\@monochromatic-dev/module-p-memoize-fork'; try { pMemoizeClear(async function plain(): Promise<void> {},); } catch (error) { error instanceof NotMemoizedError; // => true } ``` */export class NotMemoizedError extends TypeError { /** Builds the error with upstream `p-memoize`'s message text so callers migrating from `p-memoize` see identical diagnostics. */ constructor() { super('Can\'t clear a function that was not memoized!',); this.name = 'NotMemoizedError'; }}
/** Thrown by `pMemoizeClear` when the memoized function was created with caching disabled (`cache: false`), so it holds nothing to clear. @example ```ts import { CacheDisabledError, pMemoize, pMemoizeClear, } from '\@monochromatic-dev/module-p-memoize-fork'; const memoized = pMemoize({ fn: async function compute(): Promise<number> { return 1; }, options: { cache: false, }, },); try { pMemoizeClear(memoized,); } catch (error) { error instanceof CacheDisabledError; // => true } ``` */export class CacheDisabledError extends TypeError { /** Builds the error with upstream `p-memoize`'s message text so callers migrating from `p-memoize` see identical diagnostics. */ constructor() { super('Can\'t clear a function that doesn\'t use a cache!',); this.name = 'CacheDisabledError'; }}
/** Thrown by `pMemoizeClear` when the memoized function's cache storage exposes no `clear` method (a `WeakMap`, for example). @example ```ts import { UnclearableCacheError, pMemoize, pMemoizeClear, } from '\@monochromatic-dev/module-p-memoize-fork'; const memoized = pMemoize({ fn: async function compute(key: object,): Promise<number> { return 1; }, options: { cache: new WeakMap<object, number>(), }, },); try { pMemoizeClear(memoized,); } catch (error) { error instanceof UnclearableCacheError; // => true } ``` */export class UnclearableCacheError extends TypeError { /** Builds the error with upstream `p-memoize`'s message text so callers migrating from `p-memoize` see identical diagnostics. */ constructor() { super('The cache Map can\'t be cleared!',); this.name = 'UnclearableCacheError'; }}
//endregion Cache clearing errors
//region Decorator errors
/** Thrown by `pMemoizeDecorator` when the decorated declaration is not a method (a getter or class field, for example). @example ```ts import { NonMethodDecorationError, pMemoizeDecorator, } from '\@monochromatic-dev/module-p-memoize-fork'; try { pMemoizeDecorator()(function notAMethod(): void {}, { kind: 'getter', } as never,); } catch (error) { error instanceof NonMethodDecorationError; // => true } ``` */export class NonMethodDecorationError extends TypeError { /** Builds the error with upstream `p-memoize`'s message text so callers migrating from `p-memoize` see identical diagnostics. */ constructor() { super('pMemoizeDecorator can only decorate methods',); this.name = 'NonMethodDecorationError'; }}
/** Thrown by `pMemoizeDecorator` when the decorated method is private, which the decorator cannot replace per instance. @example ```ts import { pMemoizeDecorator, PrivateMethodDecorationError, } from '\@monochromatic-dev/module-p-memoize-fork'; try { pMemoizeDecorator()(function secret(): void {}, { kind: 'method', private: true, } as never,); } catch (error) { error instanceof PrivateMethodDecorationError; // => true } ``` */export class PrivateMethodDecorationError extends TypeError { /** Builds the error with upstream `p-memoize`'s message text so callers migrating from `p-memoize` see identical diagnostics. */ constructor() { super('pMemoizeDecorator cannot decorate private methods',); this.name = 'PrivateMethodDecorationError'; }}
//endregion Decorator errors
//region Function copying errors
/** Thrown by the inlined `mimic-function` copy when a property reported by `Reflect.ownKeys` has no own descriptor, which the JavaScript object model forbids; thrown instead of copying blind. @example ```ts import { PropertyDescriptorMissingError, } from '\@monochromatic-dev/module-p-memoize-fork'; new PropertyDescriptorMissingError() instanceof PropertyDescriptorMissingError; // => true ``` */export class PropertyDescriptorMissingError extends TypeError { /** Builds the error naming the invariant, since no upstream message text exists for this repository-only guard. */ constructor() { super('Expected an own property descriptor for a key from Reflect.ownKeys',); this.name = 'PropertyDescriptorMissingError'; }}
//endregion Function copying errors