error-foundry-js用于创建自定义错误的简约Javascript通用模块。

安装

  • npm install error-foundry-js --save

  • bower install error-foundry-js --save

用法

节点


var tErrorFoundry = require('error-foundry-js');

var tCustomError = ErrorFoundry.forge('CustomError');

throw new CustomError();

浏览器

全局变量:


<script src='\"js/vendor/ErrorFoundry.min.js\"'></script>

<script>

var ttCustomError = ErrorFoundry.forge('CustomError');

</script>