Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
window.addEventListener('unhandledrejection', function (event) {
// reason可能是正常的字符串, 也可能会有message和stack信息
// 如果有的话, 就抓一下
var promiseErrorInfo = '';
var reason = '';
try {
promiseErrorInfo = _JSON$stringify(_.get(event, ['promise'], ''));
reason = _JSON$stringify(_.get(event, ['reason'], ''));
} catch (e) {
console.log('promise stringify出错===>' + e);
promiseErrorInfo = _.get(event, ['promise'], '') + ''; // 稳稳的 [object Promise]
reason = _.get(event, ['reason'], '') + '';
}
var message = _.get(event, ['reason', 'message'], '');
var stack = _.get(event, ['reason', 'stack'], '');
var desc = "Unhandled_Rejection:" + promiseErrorInfo; // 这里也去调用
if (desc && stack) {
var _context;
window.addEventListener('unhandledrejection', function (event) {
// reason可能是正常的字符串, 也可能会有message和stack信息
// 如果有的话, 就抓一下
var promiseErrorInfo = '';
var reason = '';
try {
promiseErrorInfo = _JSON$stringify(_.get(event, ['promise'], ''));
reason = _JSON$stringify(_.get(event, ['reason'], ''));
} catch (e) {
console.log('promise stringify出错===>' + e);
promiseErrorInfo = _.get(event, ['promise'], '') + ''; // 稳稳的 [object Promise]
reason = _.get(event, ['reason'], '') + '';
}
var message = _.get(event, ['reason', 'message'], '');
var stack = _.get(event, ['reason', 'stack'], '');
var desc = "Unhandled_Rejection:" + promiseErrorInfo; // 这里也去调用
if (desc && stack) {
var _context;