@@ -133,50 +133,34 @@ export const safeExecute = async (fn, context = '', fallback = null) => {
133133 * Setup global error handling for wallet extensions
134134 */
135135export const setupGlobalErrorHandling = ( ) => {
136- // Handle unhandled promise rejections
136+ // Only set up basic error handling without overriding console methods
137+ // to prevent interference with application initialization
138+
139+ // Handle unhandled promise rejections from external sources
137140 window . addEventListener ( 'unhandledrejection' , ( event ) => {
138- if ( shouldSuppressError ( event . reason ) ) {
139- event . preventDefault ( ) ; // Prevent console noise
141+ const error = event . reason ;
142+ if ( shouldSuppressError ( error ) ) {
143+ // Don't prevent the error, just log it quietly
140144 if ( process . env . NODE_ENV === 'development' ) {
141- console . debug ( '[SUPPRESSED REJECTION]:' , event . reason ) ;
145+ console . debug ( '[EXTERNAL REJECTION]:' , error ) ;
142146 }
147+ // Note: We don't call event.preventDefault() to avoid breaking other error handling
143148 }
144149 } ) ;
145150
146- // Handle general window errors
151+ // Handle general window errors from external sources
147152 window . addEventListener ( 'error' , ( event ) => {
148- if ( shouldSuppressError ( event . error ) ) {
149- event . preventDefault ( ) ; // Prevent console noise
153+ const error = event . error ;
154+ if ( shouldSuppressError ( error ) && event . filename &&
155+ ( event . filename . includes ( 'extension' ) || event . filename . includes ( 'inpage.js' ) ) ) {
156+ // Only suppress errors that are clearly from browser extensions
150157 if ( process . env . NODE_ENV === 'development' ) {
151- console . debug ( '[SUPPRESSED ERROR]:' , event . error ) ;
158+ console . debug ( '[EXTERNAL ERROR]:' , error ) ;
152159 }
160+ // Note: We don't call event.preventDefault() to avoid breaking application errors
153161 }
154162 } ) ;
155163
156- // Override console.error for external error filtering
157- const originalConsoleError = console . error ;
158- console . error = ( ...args ) => {
159- // Check if any argument contains external error patterns
160- const hasExternalError = args . some ( arg => {
161- if ( typeof arg === 'string' ) {
162- return KNOWN_EXTERNAL_ERRORS . some ( pattern => arg . includes ( pattern ) ) ;
163- }
164- if ( arg instanceof Error ) {
165- return shouldSuppressError ( arg ) ;
166- }
167- return false ;
168- } ) ;
169-
170- if ( hasExternalError ) {
171- if ( process . env . NODE_ENV === 'development' ) {
172- console . debug ( '[FILTERED ERROR]:' , ...args ) ;
173- }
174- return ;
175- }
176-
177- originalConsoleError . apply ( console , args ) ;
178- } ;
179-
180164 console . log ( '[ErrorHandling] Global error filtering initialized' ) ;
181165} ;
182166
0 commit comments