Skip to content

Commit 6f052ab

Browse files
committed
chore: highlight swallowed errors from await blocks in DEV
1 parent 6577d99 commit 6f052ab

File tree

1 file changed

+5
-5
lines changed
  • packages/svelte/src/internal/client/dom/blocks

1 file changed

+5
-5
lines changed

packages/svelte/src/internal/client/dom/blocks/await.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,9 @@ export function await_block(node, get_input, pending_fn, then_fn, catch_fn) {
8080
else then_effect = branch(() => then_fn(anchor, input_source));
8181
}
8282

83-
if (state === CATCH) {
84-
if (catch_fn) {
83+
if (state === CATCH && catch_fn) {
8584
if (catch_effect) resume_effect(catch_effect);
8685
else catch_effect = branch(() => catch_fn(anchor, error_source));
87-
} else if (DEV) {
88-
console.error(error_source.v);
89-
}
9086
}
9187

9288
if (state !== PENDING && pending_effect) {
@@ -135,6 +131,10 @@ export function await_block(node, get_input, pending_fn, then_fn, catch_fn) {
135131
// but let's use internal_set for consistency and just to be safe
136132
internal_set(error_source, error);
137133
update(CATCH, true);
134+
if (!catch_fn && DEV) {
135+
// eslint-disable-next-line no-console
136+
console.error(error_source.v);
137+
}
138138
}
139139
);
140140

0 commit comments

Comments
 (0)