@binart/jx-error
v1.0.11
Published
> TODO: description
Downloads
12
Readme
Error Define
Usage
import {BizError} from 'jx-cores';
var error1 = new BizError(); // { err: -3.14, msg: "未定义错误", name: "未知业务"}
error1.named("体验权限").err(1001).msg("您没有体验权限,请联系管理员获取");
error1.is("无体验权限错误") // true
error1.is(1001) // true
error.is(1000) // false
BizError.Failure(1002, "请求超时,请稍后再试", "网络");
// { err: 1002, msg: "请求超时,请稍后再试", name: "网络" }
BizError.Failure(2001, "支付密码错误,请输入正确的密码", "支付");
// { err: 2001, msg: "支付密码错误,请输入正确的密码", name: "支付"}