@@ -291,67 +291,58 @@ export function handle_error(error, effect, previous_effect, component_context)
291291		is_throwing_error  =  true ; 
292292	} 
293293
294- 	if  ( 
295- 		! DEV  || 
296- 		component_context  ===  null  || 
297- 		! ( error  instanceof  Error )  || 
298- 		handled_errors . has ( error ) 
299- 	)  { 
300- 		propagate_error ( error ,  effect ) ; 
301- 		return ; 
302- 	} 
303- 
304- 	handled_errors . add ( error ) ; 
294+ 	if  ( DEV  &&  component_context  !==  null  &&  error  instanceof  Error  &&  ! handled_errors . has ( error ) )  { 
295+ 		handled_errors . add ( error ) ; 
305296
306- 	const  component_stack  =  [ ] ; 
297+ 		 const  component_stack  =  [ ] ; 
307298
308- 	const  effect_name  =  effect . fn ?. name ; 
299+ 		 const  effect_name  =  effect . fn ?. name ; 
309300
310- 	if  ( effect_name )  { 
311- 		component_stack . push ( effect_name ) ; 
312- 	} 
301+ 		 if  ( effect_name )  { 
302+ 			 component_stack . push ( effect_name ) ; 
303+ 		 } 
313304
314- 	/** @type  {ComponentContext | null } */ 
315- 	let  current_context  =  component_context ; 
305+ 		 /** @type  {ComponentContext | null } */ 
306+ 		 let  current_context  =  component_context ; 
316307
317- 	while  ( current_context  !==  null )  { 
318- 		if  ( DEV )  { 
308+ 		while  ( current_context  !==  null )  { 
319309			/** @type  {string } */ 
320310			var  filename  =  current_context . function ?. [ FILENAME ] ; 
321311
322312			if  ( filename )  { 
323313				const  file  =  filename . split ( '/' ) . pop ( ) ; 
324314				component_stack . push ( file ) ; 
325315			} 
316+ 
317+ 			current_context  =  current_context . p ; 
326318		} 
327319
328- 		current_context  =  current_context . p ; 
329- 	} 
320+ 		const  indent  =  is_firefox  ? '  '  : '\t' ; 
321+ 		define_property ( error ,  'message' ,  { 
322+ 			value :
323+ 				error . message  +  `\n${ component_stack . map ( ( name )  =>  `\n${ indent }  in ${ name }  ` ) . join ( '' ) }  \n` 
324+ 		} ) ; 
325+ 		define_property ( error ,  'component_stack' ,  { 
326+ 			value : component_stack 
327+ 		} ) ; 
330328
331- 	const  indent  =  is_firefox  ? '  '  : '\t' ; 
332- 	define_property ( error ,  'message' ,  { 
333- 		value : error . message  +  `\n${ component_stack . map ( ( name )  =>  `\n${ indent }  in ${ name }  ` ) . join ( '' ) }  \n` 
334- 	} ) ; 
335- 	define_property ( error ,  'component_stack' ,  { 
336- 		value : component_stack 
337- 	} ) ; 
338- 
339- 	const  stack  =  error . stack ; 
340- 
341- 	// Filter out internal files from callstack 
342- 	if  ( stack )  { 
343- 		const  lines  =  stack . split ( '\n' ) ; 
344- 		const  new_lines  =  [ ] ; 
345- 		for  ( let  i  =  0 ;  i  <  lines . length ;  i ++ )  { 
346- 			const  line  =  lines [ i ] ; 
347- 			if  ( line . includes ( 'svelte/src/internal' ) )  { 
348- 				continue ; 
329+ 		const  stack  =  error . stack ; 
330+ 
331+ 		// Filter out internal files from callstack 
332+ 		if  ( stack )  { 
333+ 			const  lines  =  stack . split ( '\n' ) ; 
334+ 			const  new_lines  =  [ ] ; 
335+ 			for  ( let  i  =  0 ;  i  <  lines . length ;  i ++ )  { 
336+ 				const  line  =  lines [ i ] ; 
337+ 				if  ( line . includes ( 'svelte/src/internal' ) )  { 
338+ 					continue ; 
339+ 				} 
340+ 				new_lines . push ( line ) ; 
349341			} 
350- 			new_lines . push ( line ) ; 
342+ 			define_property ( error ,  'stack' ,  { 
343+ 				value : new_lines . join ( '\n' ) 
344+ 			} ) ; 
351345		} 
352- 		define_property ( error ,  'stack' ,  { 
353- 			value : new_lines . join ( '\n' ) 
354- 		} ) ; 
355346	} 
356347
357348	propagate_error ( error ,  effect ) ; 
0 commit comments