Skip to content

Commit 8411533

Browse files
committed
add error handling logic
1 parent 28bd49f commit 8411533

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/kit/src/runtime/server/page/load_node.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ export async function load_node({
6666
? await load_shadow_data(
6767
/** @type {import('types/internal').SSRPage} */ (route),
6868
event,
69+
options,
6970
!!state.prerender
7071
)
7172
: {};
@@ -360,10 +361,11 @@ export async function load_node({
360361
*
361362
* @param {import('types/internal').SSRPage} route
362363
* @param {import('types/hooks').RequestEvent} event
364+
* @param {import('types/internal').SSROptions} options
363365
* @param {boolean} prerender
364366
* @returns {Promise<import('types/endpoint').ShadowData>}
365367
*/
366-
async function load_shadow_data(route, event, prerender) {
368+
async function load_shadow_data(route, event, options, prerender) {
367369
if (!route.shadow) return {};
368370

369371
try {
@@ -440,9 +442,12 @@ async function load_shadow_data(route, event, prerender) {
440442

441443
return data;
442444
} catch (e) {
445+
const error = coalesce_to_error(e);
446+
options.handle_error(error, event);
447+
443448
return {
444449
status: 500,
445-
error: coalesce_to_error(e)
450+
error
446451
};
447452
}
448453
}

0 commit comments

Comments
 (0)