diff --git a/packages/core/src/errors.ts b/packages/core/src/errors.ts index b00c5b33..ad3f37e1 100644 --- a/packages/core/src/errors.ts +++ b/packages/core/src/errors.ts @@ -1,17 +1,9 @@ export class ReDotError extends Error { - static from(error: T, message?: string): ReDotError { - return new ReDotError(message, { cause: error }); + static from(error: T, message?: string) { + return new this(message, { cause: error }); } } -export class QueryError extends ReDotError { - static override from(error: T, message?: string): QueryError { - return new QueryError(message, { cause: error }); - } -} +export class QueryError extends ReDotError {} -export class MutationError extends ReDotError { - static override from(error: T, message?: string): MutationError { - return new MutationError(message, { cause: error }); - } -} +export class MutationError extends ReDotError {} diff --git a/packages/react/src/utils/jotai.ts b/packages/react/src/utils/jotai.ts index 8f2529a3..b3314f0f 100644 --- a/packages/react/src/utils/jotai.ts +++ b/packages/react/src/utils/jotai.ts @@ -22,8 +22,8 @@ export class AtomFamilyError extends QueryError { ? Param : unknown, message?: string, - ): AtomFamilyError { - return new AtomFamilyError(atomFamily, param, message, { + ) { + return new this(atomFamily, param, message, { cause: error, }); }