Make helper.getExceptionMessage synchronous

We now have description of an exception, no need for a roundtrip
to the backend.
This commit is contained in:
Andrey Lushnikov
2017-07-21 11:57:25 -07:00
parent 0960dc38d1
commit aba61de905
4 changed files with 11 additions and 26 deletions

View File

@@ -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;