2024-04-06 13:25:13 +08:00
|
|
|
var _ = require('underscore');
|
|
|
|
|
|
|
|
var ERRORS = {
|
|
|
|
generic: {
|
|
|
|
level: 'error',
|
|
|
|
refresh: true
|
|
|
|
},
|
|
|
|
limit: {
|
|
|
|
level: 'error',
|
2024-04-09 12:00:11 +08:00
|
|
|
error: '超时',
|
|
|
|
message: '服务器响应时间过长。 请稍后重试.',
|
2024-04-06 13:25:13 +08:00
|
|
|
refresh: true
|
|
|
|
},
|
|
|
|
no_data_available: {
|
|
|
|
level: 'alert',
|
2024-04-09 12:00:11 +08:00
|
|
|
error: '无可用数据',
|
|
|
|
message: '数据的过滤器组合没有结果。尝试调整您的过滤器,或缩放和平移地图以调整地图视图.',
|
2024-04-06 13:25:13 +08:00
|
|
|
refresh: false
|
|
|
|
},
|
|
|
|
too_many_bins: {
|
|
|
|
level: 'error',
|
2024-04-09 12:00:11 +08:00
|
|
|
error: '返回的容器过多',
|
|
|
|
message: '尝试选择粒度更小的聚合或过滤数据源.',
|
2024-04-06 13:25:13 +08:00
|
|
|
refresh: false
|
|
|
|
},
|
|
|
|
dataview: {
|
|
|
|
level: 'error',
|
|
|
|
refresh: false
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = function (error) {
|
|
|
|
var type = error && error.type && _.has(ERRORS, error.type)
|
|
|
|
? error.type
|
|
|
|
: 'generic';
|
|
|
|
return _.extend({}, error, ERRORS[type]);
|
|
|
|
};
|