diff --git a/packages/vike-react-query/src/withFallback.tsx b/packages/vike-react-query/src/withFallback.tsx index 9fdf410c..798b4307 100644 --- a/packages/vike-react-query/src/withFallback.tsx +++ b/packages/vike-react-query/src/withFallback.tsx @@ -6,7 +6,7 @@ type RetryOptions = { retryQuery?: boolean } type RetryFn = (options?: RetryOptions) => void type ErrorFallbackProps = { - error: { message: string } + error: { message: string } & Record retry: RetryFn } @@ -63,6 +63,11 @@ export function withFallback>( const error = { message } if (typeof originalError === 'object') { Object.assign(error, originalError) + for (const key of ['name', 'stack', 'cause']) { + if (key in originalError) { + Object.assign(error, { [key]: originalError[key] }) + } + } } return error }