defer.reject() 中的量角器不显示堆栈跟踪?也就是不知道是哪一行代码
defer.reject() in protractor does not show the stack trace? That is, I don't know which line of the code
我使用 defer.rejct() 作为错误处理方法。
但是,当它抛出失败时,它没有显示堆栈跟踪。
有没有使用 promise 在量角器中捕获异常的简单方法?
function formatPoolRecordsGridData(row) {
var defer = protractor.promise.defer();
switch (record.poolLevelRecordType) {
case "A":
<do something here>
break;
default:
//Error Handling
defer.reject('There is no matched record type');
break;
}
//There is no way to say which line of the code it is failed
Message:
Failed: There is no matched record type
Stack:
Error: Failed: There is no matched record type
at /usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:101:16
at Promise.invokeCallback_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1329:14)
at TaskQueue.execute_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2790:14)
at TaskQueue.executeNext_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2773:21)
错误对象只会捕获对调试有用的堆栈跟踪
Reject只会拒绝promise并调用对应的fail方法
拒绝错误对象,它只会捕获堆栈 trace.ex:
reject(new Error("There is no matched record type"));
我使用 defer.rejct() 作为错误处理方法。 但是,当它抛出失败时,它没有显示堆栈跟踪。 有没有使用 promise 在量角器中捕获异常的简单方法?
function formatPoolRecordsGridData(row) {
var defer = protractor.promise.defer();
switch (record.poolLevelRecordType) {
case "A":
<do something here>
break;
default:
//Error Handling
defer.reject('There is no matched record type');
break;
}
//There is no way to say which line of the code it is failed
Message:
Failed: There is no matched record type
Stack:
Error: Failed: There is no matched record type
at /usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:101:16
at Promise.invokeCallback_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1329:14)
at TaskQueue.execute_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2790:14)
at TaskQueue.executeNext_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2773:21)
错误对象只会捕获对调试有用的堆栈跟踪
Reject只会拒绝promise并调用对应的fail方法
拒绝错误对象,它只会捕获堆栈 trace.ex:
reject(new Error("There is no matched record type"));