Skip to content

Commit 693da2c

Browse files
committed
merge main
2 parents ed8d73f + 3f3cf9f commit 693da2c

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

.changeset/large-balloons-agree.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: don't show adjusted error messages in boundaries

packages/svelte/src/internal/client/error-handling.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,12 @@ export function invoke_error_boundary(error, effect) {
6666
throw error;
6767
}
6868

69-
/** @type {WeakSet<Error>} */
70-
const adjusted_errors = new WeakSet();
71-
7269
/**
7370
* Add useful information to the error message/stack in development
7471
* @param {Error} error
7572
* @param {Effect} effect
7673
*/
7774
function get_adjustments(error, effect) {
78-
if (adjusted_errors.has(error)) return;
79-
adjusted_errors.add(error);
80-
8175
const message_descriptor = get_descriptor(error, 'message');
8276

8377
// if the message was already changed and it's not configurable we can't change it

packages/svelte/tests/runtime-runes/samples/error-boundary-3/_config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ export default test({
99
flushSync();
1010

1111
assert.deepEqual(logs, ['error caught']);
12-
assert.htmlEqual(target.innerHTML, `<div>Fallback!</div><button>+</button>`);
12+
assert.htmlEqual(target.innerHTML, `<div>oh no!</div><button>+</button>`);
1313
}
1414
});

packages/svelte/tests/runtime-runes/samples/error-boundary-3/main.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script>
22
function throw_error() {
3-
throw new Error('test')
3+
throw new Error('oh no!')
44
}
55
66
let count = $state(0);
@@ -9,8 +9,8 @@
99
<svelte:boundary onerror={(e) => console.log('error caught')}>
1010
{count > 0 ? throw_error() : null}
1111

12-
{#snippet failed()}
13-
<div>Fallback!</div>
12+
{#snippet failed(e)}
13+
<div>{e.message}</div>
1414
{/snippet}
1515
</svelte:boundary>
1616

0 commit comments

Comments
 (0)