Skip to content

Commit 3564bd2

Browse files
committed
refactor: stricter error
1 parent 191681e commit 3564bd2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/data-loaders/defineLoader.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ export function defineBasicLoader<Data>(
227227
}
228228
}
229229
})
230-
.catch((e) => {
230+
.catch((error: unknown) => {
231231
// console.log(
232232
// '‼️ rejected',
233233
// to.fullPath,
@@ -237,17 +237,17 @@ export function defineBasicLoader<Data>(
237237
if (entry.pendingLoad === currentLoad) {
238238
// help users find non-exposed loaders during development
239239
if (process.env.NODE_ENV !== 'production') {
240-
if (e instanceof NavigationResult) {
240+
if (error instanceof NavigationResult) {
241241
warnNonExposedLoader({ to, options, useDataLoader })
242242
}
243243
}
244244
// in this case, commit will never be called so we should just drop the error
245245
// console.log(`🚨 error in "${options.key}"`, e)
246-
entry.stagedError = e
246+
entry.stagedError = error
247247
// propagate error if non lazy or during SSR
248248
// NOTE: Cannot be handled at the guard level because of nested loaders
249249
if (!toLazyValue(options.lazy, to, from) || isSSR) {
250-
throw e
250+
throw error
251251
}
252252
}
253253
})

0 commit comments

Comments
 (0)