Skip to content

Commit e8cc9d8

Browse files
committed
Merge pull request #84 from SunLn/fix_http_parsejson_error
fix parse json error when http is like ERR_ADDRESS_UNREACHABLE
2 parents a8917b6 + eb44ae6 commit e8cc9d8

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)