Skip to content

Commit 213b05e

Browse files
committed
解决有时导入报错;优化错误处理提示的体验
1 parent 7e86500 commit 213b05e

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

js/main.js

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,8 @@
369369
valString = valString.substring(0, i + 1)
370370
// alert('valString = ' + valString)
371371
var _$_this_$_ = JSON.parse(valString) || {}
372-
path = _$_this_$_.path
373-
table = _$_this_$_.table
372+
path = _$_this_$_ == null ? '' : _$_this_$_.path
373+
table = _$_this_$_ == null ? '' : _$_this_$_.table
374374
}
375375
}
376376

@@ -454,10 +454,8 @@
454454

455455
// APIJSON <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
456456

457-
var ERR_MSG = `
458-
459-
可能出现了一些问题,可以按照以下步骤解决:
460-
1.检查网络连接是否畅通,可用浏览器打开右侧地址: https://www.baidu.com/s?wd=%22APIJSON%22
457+
var ERR_MSG = `出现了一些问题,可以按照以下步骤解决:
458+
1.检查网络连接是否畅通,可用浏览器打开右侧地址: https://www.baidu.com/s?wd=%22APIJSON%22
461459
2.检查 URL 是否为一个可用的 域名/IPV4 地址,可用浏览器打开试试:正常返回结果 或 非 GET 请求返回 Whitelabel Error Page,一般都没问题
462460
3.开启或关闭 右上方 设置>托管服务器代理,然后再试:如果开启后才通应该是 CORS 跨域问题;关闭后才通应该是用外网服务代理来访问内网导致,可退出登录后修改退关服务器地址为内网的 APIJSON 代理服务地址
463461
4.Disable 关闭 VPN 等 电脑/手机/平板 上的网络代理软件 App 客户端,或者切换代理服务器地址,然后再试
@@ -520,7 +518,7 @@ https://github.com/Tencent/APIJSON/issues
520518
v = JSON.parse(v)
521519
}
522520
catch (e) {
523-
this.log(e)
521+
console.log(e)
524522
}
525523
}
526524

@@ -4635,7 +4633,7 @@ https://github.com/Tencent/APIJSON/issues
46354633
var name = api == null ? null : api.name;
46364634
if (StringUtil.isEmpty(name, true) == false) {
46374635
this.urlComment = name;
4638-
vUrlComment.value = vUrl.value + CodeUtil.getComment(this.urlComment, false, ' ')
4636+
vUrlComment.value = vUrl.value + CodeUtil.getComment(this.urlComment, false, ' ')
46394637
}
46404638
}
46414639

@@ -5054,6 +5052,7 @@ https://github.com/Tencent/APIJSON/issues
50545052
// crossDomain: true
50555053
})
50565054
.then(function (res) {
5055+
clearTimeout(errHandler)
50575056
var postEvalResult = evalPostScript(url, res, null)
50585057
if (postEvalResult == BREAK_ALL) {
50595058
return
@@ -5366,7 +5365,7 @@ https://github.com/Tencent/APIJSON/issues
53665365
// vOutput.value = "Response:\nurl = " + url + "\nerror = " + err.message;
53675366
this.view = 'error';
53685367
this.error = {
5369-
msg: "Response:\nurl = " + url + "\nerror = " + err.message + ERR_MSG
5368+
msg: "Response:\nurl = " + url + "\nerror = " + err.message + '\n\n' + ERR_MSG
53705369
}
53715370
}
53725371
}
@@ -6089,7 +6088,6 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
60896088

60906089
//转为文档格式
60916090
var doc = '';
6092-
var item;
60936091

60946092
//[] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
60956093
var list = docObj == null ? null : docObj['[]'];
@@ -6236,7 +6234,7 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
62366234
+ ' \n -------- | -------------- ';
62376235

62386236
for (var i = 0; i < list.length; i++) {
6239-
item = list[i];
6237+
var item = list[i];
62406238
if (item == null) {
62416239
continue;
62426240
}
@@ -6265,7 +6263,7 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
62656263
+ ' \n -------- | ------------ | ------------ | ------------ ';
62666264

62676265
for (var i = 0; i < list.length; i++) {
6268-
item = list[i];
6266+
var item = list[i];
62696267
if (item == null) {
62706268
continue;
62716269
}
@@ -7883,7 +7881,7 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
78837881
this.log('test for ' + i + ' >> try { header = this.getHeader(document.header) } catch (e) { \n' + e.message)
78847882
}
78857883
const header = hdr
7886-
7884+
78877885
const caseScript = {
78887886
pre: item['Script:pre'],
78897887
post: item['Script:post']
@@ -7912,6 +7910,7 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
79127910
} catch (e) {
79137911
App.log('test App.request >> } catch (e) {\n' + e.message)
79147912
}
7913+
79157914
}
79167915

79177916
const otherErr = err
@@ -10175,7 +10174,6 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
1017510174
App.selectIndex = -1;
1017610175
App.options = [];
1017710176
})
10178-
1017910177
}
1018010178
}
1018110179

0 commit comments

Comments
 (0)