Browse Source

优化错误提示

es6
guy 3 years ago
parent
commit
3ef9f62df5
  1. 4
      src/base/combination/loader.js
  2. 2
      src/core/2.base.js
  3. 2
      src/core/4.widget.js
  4. 2
      src/core/5.shortcut.js
  5. 2
      src/core/controller/controller.layer.js
  6. 2
      src/core/listener/listener.show.js
  7. 6
      src/core/wrapper/layout/adapt/absolute.leftrightvertical.js
  8. 6
      src/core/wrapper/layout/adapt/adapt.leftrightvertical.js
  9. 2
      src/core/wrapper/layout/flex/flex.leftrightvertical.center.js
  10. 2
      src/core/wrapper/layout/layout.border.js
  11. 6
      src/core/wrapper/layout/layout.card.js
  12. 4
      src/core/wrapper/layout/layout.division.js
  13. 2
      src/core/wrapper/layout/layout.grid.js
  14. 2
      src/core/wrapper/layout/layout.inline.js
  15. 4
      src/core/wrapper/layout/layout.table.js
  16. 4
      src/core/wrapper/layout/layout.tape.js
  17. 2
      src/core/wrapper/layout/layout.td.js
  18. 4
      src/core/wrapper/layout/layout.window.js
  19. 2
      src/core/wrapper/layout/middle/middle.center.js
  20. 2
      src/core/wrapper/layout/middle/middle.float.center.js
  21. 2
      src/core/wrapper/layout/middle/middle.horizontal.js
  22. 2
      src/core/wrapper/layout/middle/middle.vertical.js
  23. 4
      src/data/pool/pool.buffer.js

4
src/base/combination/loader.js

@ -169,7 +169,7 @@ BI.Loader = BI.inherit(BI.Widget, {
if (arguments.length === 0 && (BI.isFunction(o.itemsCreator))) {
o.itemsCreator.apply(this, [{times: 1}, function () {
if (arguments.length === 0) {
throw new Error("arguments can not be null!!!");
throw new Error("参数不能为空");
}
self.populate.apply(self, arguments);
o.onLoaded();
@ -257,4 +257,4 @@ BI.Loader = BI.inherit(BI.Widget, {
}
});
BI.Loader.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.loader", BI.Loader);
BI.shortcut("bi.loader", BI.Loader);

2
src/core/2.base.js

@ -75,7 +75,7 @@ if (!_global.BI) {
createWidgets: function (items, options, context) {
if (!BI.isArray(items)) {
throw new Error("cannot create Widgets");
throw new Error("items必须是数组", items);
}
if (BI.isWidget(options)) {
context = options;

2
src/core/4.widget.js

@ -449,7 +449,7 @@
}
name = name || widget.getName() || BI.uniqueId("widget");
if (this._children[name]) {
throw new Error("name has already been existed");
throw new Error("组件:组件名已存在,不能进行添加");
}
widget._setParent && widget._setParent(this);
widget.on(BI.Events.DESTROY, function () {

2
src/core/5.shortcut.js

@ -88,7 +88,7 @@
if (BI.isWidget(item.el)) {
return item.el;
}
throw new Error("组件创建:无法根据item创建组件", item);
throw new Error("组件:无法根据item创建组件", item);
};
BI._lazyCreateWidget = BI._lazyCreateWidget || function (item, options, context) {

2
src/core/controller/controller.layer.js

@ -124,7 +124,7 @@ BI.LayerController = BI.inherit(BI.Controller, {
add: function (name, layer, layout) {
if (this.has(name)) {
throw new Error("name is already exist");
throw new Error("不能创建同名的Layer");
}
layout.setVisible(false);
this.layerManager[name] = layer;

2
src/core/listener/listener.show.js

@ -27,7 +27,7 @@ BI.ShowListener = BI.inherit(BI.OB, {
v = v || o.eventObj.getValue();
v = BI.isArray(v) ? (v.length > 1 ? v.toString() : v[0]) : v;
if (BI.isNull(v)) {
throw new Error("value cannot be null");
throw new Error("不能为null");
}
var cardName = o.cardNameCreator(v);
if (!o.cardLayout.isCardExisted(cardName)) {

6
src/core/wrapper/layout/adapt/absolute.leftrightvertical.js

@ -85,7 +85,7 @@ BI.AbsoluteLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
addItem: function () {
// do nothing
throw new Error("cannot be added");
throw new Error("不能添加子组件");
},
populate: function (items) {
@ -137,11 +137,11 @@ BI.AbsoluteRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
addItem: function () {
// do nothing
throw new Error("cannot be added");
throw new Error("不能添加子组件");
},
populate: function (items) {
this.layout.populate(items);
}
});
BI.shortcut("bi.absolute_right_vertical_adapt", BI.AbsoluteRightVerticalAdaptLayout);
BI.shortcut("bi.absolute_right_vertical_adapt", BI.AbsoluteRightVerticalAdaptLayout);

6
src/core/wrapper/layout/adapt/adapt.leftrightvertical.js

@ -81,7 +81,7 @@ BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
addItem: function () {
// do nothing
throw new Error("cannot be added");
throw new Error("不能添加子组件");
},
populate: function (items) {
@ -134,7 +134,7 @@ BI.LeftVerticalAdaptLayout = BI.inherit(BI.Layout, {
addItem: function () {
// do nothing
throw new Error("cannot be added");
throw new Error("不能添加子组件");
},
populate: function (items) {
@ -186,7 +186,7 @@ BI.RightVerticalAdaptLayout = BI.inherit(BI.Layout, {
addItem: function () {
// do nothing
throw new Error("cannot be added");
throw new Error("不能添加子组件");
},
populate: function (items) {

2
src/core/wrapper/layout/flex/flex.leftrightvertical.center.js

@ -75,7 +75,7 @@ BI.FlexLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
addItem: function () {
// do nothing
throw new Error("cannot be added");
throw new Error("不能添加子组件");
},
populate: function (items) {

2
src/core/wrapper/layout/layout.border.js

@ -22,7 +22,7 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
addItem: function (item) {
// do nothing
throw new Error("cannot be added");
throw new Error("不能添加子组件");
},
stroke: function (regions) {

6
src/core/wrapper/layout/layout.card.js

@ -70,7 +70,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
getCardByName: function (cardName) {
if (!this.isCardExisted(cardName)) {
throw new Error("cardName is not exist");
throw new Error("cardName不存在", cardName);
}
return this._children[this._getChildName(cardName)];
},
@ -87,7 +87,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
deleteCardByName: function (cardName) {
if (!this.isCardExisted(cardName)) {
throw new Error("cardName is not exist");
throw new Error("cardName不存在", cardName);
}
var child = this._children[this._getChildName(cardName)];
@ -97,7 +97,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
addCardByName: function (cardName, cardItem) {
if (this.isCardExisted(cardName)) {
throw new Error("cardName is already exist");
throw new Error("cardName 已存在", cardName);
}
var widget = BI._lazyCreateWidget(cardItem, this);
widget.element.css({

4
src/core/wrapper/layout/layout.division.js

@ -47,7 +47,7 @@ BI.DivisionLayout = BI.inherit(BI.Layout, {
addItem: function (item) {
// do nothing
throw new Error("cannot be added");
throw new Error("不能添加子组件");
},
stroke: function (items) {
@ -112,7 +112,7 @@ BI.DivisionLayout = BI.inherit(BI.Layout, {
var totalW = 0;
for (var j = 0; j < columns; j++) {
if (!map[i][j]) {
throw new Error("item be required");
throw new Error("item(" + i + "" + j + ") 必须", map);
}
if (!this.hasWidget(this._getChildName(i + "_" + j))) {
var w = BI._lazyCreateWidget(map[i][j]);

2
src/core/wrapper/layout/layout.grid.js

@ -41,7 +41,7 @@ BI.GridLayout = BI.inherit(BI.Layout, {
addItem: function () {
// do nothing
throw new Error("cannot be added");
throw new Error("不能添加子组件");
},
stroke: function (items) {

2
src/core/wrapper/layout/layout.inline.js

@ -99,7 +99,7 @@ BI.InlineLayout = BI.inherit(BI.Layout, {
},
addItem: function (item) {
throw new Error("不能添加元素");
throw new Error("不能添加子组件");
},
populate: function (items) {

4
src/core/wrapper/layout/layout.table.js

@ -88,7 +88,7 @@ BI.TableLayout = BI.inherit(BI.Layout, {
}, arr[j]));
right += o.columnSize[j] + (o.columnSize[j] < 1 ? 0 : o.hgap);
} else {
throw new Error("item with fill can only be one");
throw new Error("构造错误", arr);
}
}
if (i >= 0 && i < arr.length) {
@ -123,7 +123,7 @@ BI.TableLayout = BI.inherit(BI.Layout, {
addItem: function (arr) {
if (!BI.isArray(arr)) {
throw new Error("item must be array");
throw new Error("必须是数组", arr);
}
return BI.TableLayout.superclass.addItem.apply(this, arguments);
},

4
src/core/wrapper/layout/layout.tape.js

@ -28,7 +28,7 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
},
addItem: function (item) {
// do nothing
throw new Error("cannot be added");
throw new Error("不能添加子组件");
},
stroke: function (items) {
@ -168,7 +168,7 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
addItem: function (item) {
// do nothing
throw new Error("cannot be added");
throw new Error("不能添加子组件");
},
stroke: function (items) {

2
src/core/wrapper/layout/layout.td.js

@ -163,7 +163,7 @@ BI.TdLayout = BI.inherit(BI.Layout, {
addItem: function (arr) {
if (!BI.isArray(arr)) {
throw new Error("item must be array");
throw new Error("必须是数组", arr);
}
return BI.TdLayout.superclass.addItem.apply(this, arguments);
},

4
src/core/wrapper/layout/layout.window.js

@ -31,7 +31,7 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
addItem: function (item) {
// do nothing
throw new Error("cannot be added");
throw new Error("不能添加子组件");
},
stroke: function (items) {
@ -83,7 +83,7 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
for (var i = 0; i < o.rows; i++) {
for (var j = 0; j < o.columns; j++) {
if (!o.items[i][j]) {
throw new Error("item be required");
throw new Error("构造错误", o.items);
}
if (!this.hasWidget(this._getChildName(i + "_" + j))) {
var w = BI._lazyCreateWidget(o.items[i][j]);

2
src/core/wrapper/layout/middle/middle.center.js

@ -62,7 +62,7 @@ BI.CenterLayout = BI.inherit(BI.Layout, {
addItem: function (item) {
// do nothing
throw new Error("cannot be added");
throw new Error("不能添加子组件");
},
update: function (opt) {

2
src/core/wrapper/layout/middle/middle.float.center.js

@ -61,7 +61,7 @@ BI.FloatCenterLayout = BI.inherit(BI.Layout, {
addItem: function (item) {
// do nothing
throw new Error("cannot be added");
throw new Error("不能添加子组件");
},
update: function (opt) {

2
src/core/wrapper/layout/middle/middle.horizontal.js

@ -60,7 +60,7 @@ BI.HorizontalCenterLayout = BI.inherit(BI.Layout, {
addItem: function (item) {
// do nothing
throw new Error("cannot be added");
throw new Error("不能添加子组件");
},
update: function (opt) {

2
src/core/wrapper/layout/middle/middle.vertical.js

@ -61,7 +61,7 @@ BI.VerticalCenterLayout = BI.inherit(BI.Layout, {
addItem: function (item) {
// do nothing
throw new Error("cannot be added");
throw new Error("不能添加子组件");
},
update: function (opt) {

4
src/data/pool/pool.buffer.js

@ -10,7 +10,7 @@
BI.BufferPool = {
put: function (name, cache) {
if (BI.isNotNull(Buffer[name])) {
throw new Error("Buffer Pool has the key already!");
throw new Error("key值:[" + name + "] 已存在!", Buffer);
}
Buffer[name] = cache;
},
@ -19,4 +19,4 @@
return Buffer[name];
}
};
})();
})();

Loading…
Cancel
Save