(error)
| 13 | * @param {unknown} error |
| 14 | */ |
| 15 | export function handle_error(error) { |
| 16 | var effect = active_effect; |
| 17 | |
| 18 | // for unowned deriveds, don't throw until we read the value |
| 19 | if (effect === null) { |
| 20 | /** @type {Derived} */ (active_reaction).f |= ERROR_VALUE; |
| 21 | return error; |
| 22 | } |
| 23 | |
| 24 | if (DEV && error instanceof Error && !adjustments.has(error)) { |
| 25 | adjustments.set(error, get_adjustments(error, effect)); |
| 26 | } |
| 27 | |
| 28 | // if the error occurred while creating this subtree, we let it |
| 29 | // bubble up until it hits a boundary that can handle it, unless |
| 30 | // it's an $effect in which case it doesn't run immediately |
| 31 | if ((effect.f & REACTION_RAN) === 0 && (effect.f & EFFECT) === 0) { |
| 32 | if (DEV && !effect.parent && error instanceof Error) { |
| 33 | apply_adjustments(error); |
| 34 | } |
| 35 | |
| 36 | throw error; |
| 37 | } |
| 38 | |
| 39 | // otherwise we bubble up the effect tree ourselves |
| 40 | invoke_error_boundary(error, effect); |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * @param {unknown} error |
no test coverage detected