@@ -380,14 +380,14 @@ function performAttach() {
380
380
381
381
chrome . debugger . sendCommand (
382
382
{ tabId : currentTabId } ,
383
- "Console .enable" ,
383
+ "Runtime .enable" ,
384
384
{ } ,
385
385
( ) => {
386
386
if ( chrome . runtime . lastError ) {
387
- console . error ( "Failed to enable console :" , chrome . runtime . lastError ) ;
387
+ console . error ( "Failed to enable runtime :" , chrome . runtime . lastError ) ;
388
388
return ;
389
389
}
390
- console . log ( "Console API successfully enabled" ) ;
390
+ console . log ( "Runtime API successfully enabled" ) ;
391
391
}
392
392
) ;
393
393
} ) ;
@@ -430,12 +430,22 @@ const consoleMessageListener = (source, method, params) => {
430
430
return ;
431
431
}
432
432
433
- if ( method === "Console.messageAdded" ) {
434
- console . log ( "Console message received:" , params . message ) ;
433
+ if ( method === "Runtime.exceptionThrown" ) {
435
434
const entry = {
436
- type : params . message . level === "error" ? "console-error" : "console-log" ,
437
- level : params . message . level ,
438
- message : params . message . text ,
435
+ type : "console-error" ,
436
+ message : params . exceptionDetails . exception ?. description || JSON . stringify ( params . exceptionDetails ) ,
437
+ level : "error" ,
438
+ timestamp : Date . now ( ) ,
439
+ } ;
440
+ console . log ( "Sending runtime exception:" , entry ) ;
441
+ sendToBrowserConnector ( entry ) ;
442
+ }
443
+
444
+ if ( method === "Runtime.consoleAPICalled" ) {
445
+ const entry = {
446
+ type : params . type === "error" ? "console-error" : "console-log" ,
447
+ level : params . type ,
448
+ message : params . args [ 0 ] . value ,
439
449
timestamp : Date . now ( ) ,
440
450
} ;
441
451
console . log ( "Sending console entry:" , entry ) ;
0 commit comments