@cataract6545/tmui
Version:
tm-vuetify是一个新势力由主题驱动的UI组件库,相比其它优势大,组件全,设计趋势紧跟未来。具有主题生成,主题实时切换,暗黑实时切换,lottie动画,图表等新颖功能,tmui TMUI
40 lines (33 loc) • 715 B
JavaScript
/*eslint no-console: 0 */
class ErrorHandler {
constructor(api) {
this.api = api;
}
handleCatch(e) {
// If babel supported extending of Error in a correct way instanceof would be used here
if (e.name === "InvalidInputException") {
if (this.api._options.valid !== this.api._defaults.valid) {
this.api._options.valid(false);
}
else {
throw e.message;
}
}
else {
throw e;
}
this.api.render = function () { };
}
wrapBarcodeCall(func) {
try {
var result = func(...arguments);
this.api._options.valid(true);
return result;
}
catch (e) {
this.handleCatch(e);
return this.api;
}
}
}
export default ErrorHandler;