Skip to content

Commit

Permalink
优化错误提示
Browse files Browse the repository at this point in the history
  • Loading branch information
carsonxu committed Mar 14, 2018
1 parent 6aaaf2f commit 287118b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
10 changes: 2 additions & 8 deletions dist/cos-js-sdk-v5.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,6 @@ var checkParams = function (apiName, params) {
};

var apiWrapper = function (apiName, apiFn) {
var regionMap = {
'gz': 'ap-guangzhou',
'tj': 'ap-beijing-2',
'sh': 'ap-shanghai',
'cd': 'ap-chengdu'
};
return function (params, callback) {

// 处理参数
Expand Down Expand Up @@ -376,8 +370,8 @@ var apiWrapper = function (apiName, apiFn) {
return;
}
// 判断 region 格式
if (params.Region && regionMap[params.Region]) {
_callback({ error: 'Region should be ' + regionMap[params.Region] });
if (params.Region && params.Region.indexOf('-') === -1) {
_callback({ error: 'Region format error, find help here: https://cloud.tencent.com/document/product/436/6224' });
return;
}
// 判断 region 格式
Expand Down
2 changes: 1 addition & 1 deletion dist/cos-js-sdk-v5.min.js

Large diffs are not rendered by default.

10 changes: 2 additions & 8 deletions src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,6 @@ var checkParams = function (apiName, params) {
};

var apiWrapper = function (apiName, apiFn) {
var regionMap = {
'gz': 'ap-guangzhou',
'tj': 'ap-beijing-2',
'sh': 'ap-shanghai',
'cd': 'ap-chengdu'
};
return function (params, callback) {

// 处理参数
Expand Down Expand Up @@ -306,8 +300,8 @@ var apiWrapper = function (apiName, apiFn) {
return;
}
// 判断 region 格式
if (params.Region && regionMap[params.Region]) {
_callback({error: 'Region should be ' + regionMap[params.Region]});
if (params.Region && params.Region.indexOf('-') === -1) {
_callback({error: 'Region format error, find help here: https://cloud.tencent.com/document/product/436/6224'});
return;
}
// 判断 region 格式
Expand Down

0 comments on commit 287118b

Please sign in to comment.