Skip to content

Commit

Permalink
Merge pull request #84 from SunLn/fix_http_parsejson_error
Browse files Browse the repository at this point in the history
fix parse json error when http is like ERR_ADDRESS_UNREACHABLE
  • Loading branch information
SunLn committed Sep 6, 2015
2 parents a8917b6 + eb44ae6 commit e8cc9d8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions demo/js/qiniu.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,11 @@ function QiniuJsSDK() {
errTip = '文件验证失败。请稍后重试。';
break;
case plupload.HTTP_ERROR:
if (err.response === '') {
// Fix parseJSON error ,when http error is like net::ERR_ADDRESS_UNREACHABLE
errTip = err.message || '未知网络错误。';
break;
}
var errorObj = that.parseJSON(err.response);
var errorText = errorObj.error;
switch (err.status) {
Expand Down
5 changes: 5 additions & 0 deletions src/qiniu.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,11 @@ function QiniuJsSDK() {
errTip = '文件验证失败。请稍后重试。';
break;
case plupload.HTTP_ERROR:
if (err.response === '') {
// Fix parseJSON error ,when http error is like net::ERR_ADDRESS_UNREACHABLE
errTip = err.message || '未知网络错误。';
break;
}
var errorObj = that.parseJSON(err.response);
var errorText = errorObj.error;
switch (err.status) {
Expand Down
Loading

0 comments on commit e8cc9d8

Please sign in to comment.