pull/16091/head
Rich Harris 4 months ago
parent c4f528a7bf
commit 063eab8ce2

@ -2,7 +2,7 @@
import { BOUNDARY_EFFECT, EFFECT_TRANSPARENT } from '#client/constants';
import { component_context, set_component_context } from '../../context.js';
import { invoke_error_boundary, reset_is_throwing_error } from '../../error-handling.js';
import { invoke_error_boundary } from '../../error-handling.js';
import { block, branch, destroy_effect, pause_effect } from '../../reactivity/effects.js';
import {
active_effect,
@ -80,7 +80,6 @@ export function boundary(node, props, boundary_fn) {
with_boundary(boundary, () => {
is_creating_fallback = false;
boundary_effect = branch(() => boundary_fn(anchor));
reset_is_throwing_error();
});
};
@ -119,7 +118,6 @@ export function boundary(node, props, boundary_fn) {
invoke_error_boundary(error, /** @type {Effect} */ (boundary.parent));
}
reset_is_throwing_error();
is_creating_fallback = false;
});
});
@ -131,7 +129,6 @@ export function boundary(node, props, boundary_fn) {
}
boundary_effect = branch(() => boundary_fn(anchor));
reset_is_throwing_error();
}, EFFECT_TRANSPARENT | BOUNDARY_EFFECT);
if (hydrating) {

@ -2,19 +2,13 @@
import { DEV } from 'esm-env';
import { FILENAME } from '../../constants.js';
import { is_firefox } from './dom/operations.js';
import { BOUNDARY_EFFECT, DESTROYED } from './constants.js';
import { BOUNDARY_EFFECT } from './constants.js';
import { define_property } from '../shared/utils.js';
// Used for DEV time error handling
/** @param {WeakSet<Error>} value */
const adjusted_errors = new WeakSet();
let is_throwing_error = false;
export function reset_is_throwing_error() {
is_throwing_error = false;
}
/** @type {null | unknown} */
let current_error = null;
@ -58,20 +52,9 @@ export function invoke_error_boundary(error, effect) {
current = current.parent;
}
is_throwing_error = false;
throw error;
}
/**
* @param {Effect} effect
*/
function should_rethrow_error(effect) {
return (
(effect.f & DESTROYED) === 0 &&
(effect.parent === null || (effect.parent.f & BOUNDARY_EFFECT) === 0)
);
}
/**
* Add useful information to the error message/stack
* @param {Error} error

Loading…
Cancel
Save