Skip to content

Commit eb44ae6

Browse files
committed
fix parse json error when http is like ERR_ADDRESS_UNREACHABLE
1 parent a8917b6 commit eb44ae6

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

demo/js/qiniu.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,11 @@ function QiniuJsSDK() {
491491
errTip = '文件验证失败。请稍后重试。';
492492
break;
493493
case plupload.HTTP_ERROR:
494+
if (err.response === '') {
495+
// Fix parseJSON error ,when http error is like net::ERR_ADDRESS_UNREACHABLE
496+
errTip = err.message || '未知网络错误。';
497+
break;
498+
}
494499
var errorObj = that.parseJSON(err.response);
495500
var errorText = errorObj.error;
496501
switch (err.status) {

src/qiniu.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,11 @@ function QiniuJsSDK() {
491491
errTip = '文件验证失败。请稍后重试。';
492492
break;
493493
case plupload.HTTP_ERROR:
494+
if (err.response === '') {
495+
// Fix parseJSON error ,when http error is like net::ERR_ADDRESS_UNREACHABLE
496+
errTip = err.message || '未知网络错误。';
497+
break;
498+
}
494499
var errorObj = that.parseJSON(err.response);
495500
var errorText = errorObj.error;
496501
switch (err.status) {

0 commit comments

Comments
 (0)