File tree Expand file tree Collapse file tree 3 files changed +5
-3
lines changed Expand file tree Collapse file tree 3 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,7 @@ export function toConsoleMessageLocation(stackTrace: Protocol.Runtime.StackTrace
101
101
export function exceptionToError ( exceptionDetails : Protocol . Runtime . ExceptionDetails ) : Error {
102
102
const message = getExceptionMessage ( exceptionDetails ) ;
103
103
const err = new Error ( message ) ;
104
- err . stack = '' ; // Don't report clientside error with a node stack attached
104
+ // Don't report clientside error with a node stack attached
105
+ err . stack = 'Error: ' + err . message ; // Stack is supposed to contain error message as the first line.
105
106
return err ;
106
107
}
Original file line number Diff line number Diff line change @@ -152,7 +152,8 @@ export class Page extends platform.EventEmitter {
152
152
153
153
_didCrash ( ) {
154
154
const error = new Error ( 'Page crashed!' ) ;
155
- error . stack = '' ;
155
+ // Do not report node.js stack.
156
+ error . stack = 'Error: ' + error . message ; // Stack is supposed to contain error message as the first line.
156
157
this . emit ( 'error' , error ) ;
157
158
}
158
159
Original file line number Diff line number Diff line change @@ -322,7 +322,7 @@ export class WKPage implements PageDelegate {
322
322
}
323
323
if ( level === 'error' && source === 'javascript' ) {
324
324
const error = new Error ( text ) ;
325
- error . stack = '' ;
325
+ error . stack = 'Error: ' + error . message ; // Nullify stack. Stack is supposed to contain error message as the first line.
326
326
this . _page . emit ( Events . Page . PageError , error ) ;
327
327
return ;
328
328
}
You can’t perform that action at this time.
0 commit comments