javaScript Promise 自定义Error

//自定义构造
function MyError(message,status) {
    this.name = 'MyError';
    this.message = message ? message : 'Default Message';
    this.status = status ? status : '00';
    this.stack = (new Error()).stack;
}
MyError.prototype = Object.create(Error.prototype);
MyError.prototype.constructor = MyError;

//使用
  reject(new MyError("没有更多数据了","10"));

参考网址:http://blog.csdn.net/zhang197093/article/details/52055850

    原文作者:一个冬季
    原文地址: https://www.jianshu.com/p/f0c455002145
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞