@@ -269,11 +269,15 @@ function should_rethrow_error(effect) {
269269}
270270
271271/**
272- * @param {Error } error
272+ * @param {unknown } error
273273 * @param {Effect } effect
274274 * @param {ComponentContext | null } component_context
275275 */
276276export function handle_error ( error , effect , component_context ) {
277+ if ( ! ( error instanceof Error ) ) {
278+ throw error ;
279+ }
280+
277281 if ( handled_errors . has ( error ) ) {
278282 if ( should_rethrow_error ( effect ) ) {
279283 throw error ;
@@ -500,7 +504,7 @@ export function update_effect(effect) {
500504 dev_effect_stack . push ( effect ) ;
501505 }
502506 } catch ( error ) {
503- handle_error ( /** @type { Error } */ ( error ) , effect , previous_component_context || effect . ctx ) ;
507+ handle_error ( error , effect , previous_component_context || effect . ctx ) ;
504508 } finally {
505509 active_effect = previous_effect ;
506510
@@ -601,7 +605,7 @@ function flush_queued_effects(effects) {
601605 }
602606 }
603607 } catch ( error ) {
604- handle_error ( /** @type { Error } */ ( error ) , effect , effect . ctx ) ;
608+ handle_error ( error , effect , effect . ctx ) ;
605609 }
606610 }
607611 }
@@ -681,7 +685,7 @@ function process_effects(effect, collected_effects) {
681685 update_effect ( current_effect ) ;
682686 }
683687 } catch ( error ) {
684- handle_error ( /** @type { Error } */ ( error ) , current_effect , current_effect . ctx ) ;
688+ handle_error ( error , current_effect , current_effect . ctx ) ;
685689 }
686690 }
687691
0 commit comments