mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
Make helper.getExceptionMessage synchronous
We now have description of an exception, no need for a roundtrip to the backend.
This commit is contained in:
@@ -25,24 +25,13 @@ class Helper {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {!Connection} client
|
||||
* @param {!Object} exceptionDetails
|
||||
* @return {string}
|
||||
*/
|
||||
static async getExceptionMessage(client, exceptionDetails) {
|
||||
let message = '';
|
||||
let exception = exceptionDetails.exception;
|
||||
if (exception) {
|
||||
let response = await client.send('Runtime.callFunctionOn', {
|
||||
objectId: exception.objectId,
|
||||
functionDeclaration: 'function() { return this.message; }',
|
||||
returnByValue: true,
|
||||
});
|
||||
message = response.result.value;
|
||||
} else {
|
||||
message = exceptionDetails.text;
|
||||
}
|
||||
|
||||
static getExceptionMessage(exceptionDetails) {
|
||||
if (exceptionDetails.exception)
|
||||
return exceptionDetails.exception.description;
|
||||
let message = exceptionDetails.text;
|
||||
if (exceptionDetails.stackTrace) {
|
||||
for (let callframe of exceptionDetails.stackTrace.callFrames) {
|
||||
let location = callframe.url + ':' + callframe.lineNumber + ':' + callframe.columnNumber;
|
||||
|
||||
Reference in New Issue
Block a user