功能变化: 菜单管理按钮配置
This commit is contained in:
@@ -33,7 +33,7 @@ function createService() {
|
||||
// 根据 code 进行判断
|
||||
if (code === undefined) {
|
||||
// 如果没有 code 代表这不是项目后端开发的接口
|
||||
errorCreate(`非标准返回:${dataAxios}, ${response.config.url}`);
|
||||
errorCreate(`非标准返回:${dataAxios}, ${response.config.url}`,false);
|
||||
return dataAxios;
|
||||
} else {
|
||||
// 有 code 代表这是一个后端接口 可以进行进一步的判断
|
||||
|
||||
@@ -48,19 +48,22 @@ export function responseError(data = {}, msg = "请求失败", code = 500) {
|
||||
* @description 记录和显示错误
|
||||
* @param {Error} error 错误对象
|
||||
*/
|
||||
export function errorLog(error) {
|
||||
export function errorLog(error:any,notification=true) {
|
||||
// 打印到控制台
|
||||
console.error(error);
|
||||
// 显示提示
|
||||
uiContext.get().notification.error({ message: error.message });
|
||||
if(notification){
|
||||
uiContext.get().notification.error({ message: error.message });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 创建一个错误
|
||||
* @param {String} msg 错误信息
|
||||
*/
|
||||
export function errorCreate(msg) {
|
||||
export function errorCreate(msg:any,notification=true) {
|
||||
const error = new Error(msg);
|
||||
errorLog(error);
|
||||
throw error;
|
||||
errorLog(error,notification);
|
||||
// throw error;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user