@lcap/nasl
Version:
NetEase Application Specific Language
66 lines • 2.18 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const eventBus_1 = __importDefault(require("../../eventBus"));
const showError = (error) => (message) => {
if (typeof window === 'undefined') {
return;
}
window.$showError && window.$showError(error)(message);
};
const versionStatus = {
401010: 'version_saving',
401011: 'version_checking',
401012: 'version_checkout_failed',
401013: 'version_inconsistent',
};
exports.default = {
defaults({ config }, err = {}) {
if (config.noErrorTip)
return;
if (config?.noErrorCodeList?.includes(err.code)) {
return;
}
// 检测到租户正在降级中的错误跳转到提示页面,不报toast
if (err.code === 401809) {
return;
}
// 检测到当前应用已在新 tab 页操作,或者版本升级,备份还原
if (err.code === 500502 || err.code === 500505) {
eventBus_1.default.emit('multiTabOpened', {
refreshBrowser: err.code === 500505,
message: err.msg,
});
return;
}
if (versionStatus[err.code])
eventBus_1.default.emit('updateVersionStatus', {
status: versionStatus[err.code],
message: err.msg,
});
showError(err)(err.msg || '系统繁忙');
},
401({ config }, err = {}) {
if (config.noErrorTip)
return;
showError(err)(err.msg || '系统繁忙');
},
500({ config }, err = {}) {
if (config.noErrorTip)
return;
showError(err)(err.msg || '系统繁忙');
},
400({ config }, err = {}) {
if (config.noErrorTip || err.result)
return;
showError(err)(err.msg || '系统繁忙');
},
localError({ config }, err = {}) {
if (config.noErrorTip)
return;
showError(err)(err.msg || '系统繁忙');
},
};
//# sourceMappingURL=errHandles.js.map