We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
参考资料
The text was updated successfully, but these errors were encountered:
// 创建一个新对象,并以原型链的方式 Error function MyError(message) { this.name = 'MyError'; this.message = message || 'Default Message'; this.stack = (new Error()).stack; } MyError.prototype = Object.create(Error.prototype); MyError.prototype.constructor = MyError; try { throw new MyError(); } catch (e) { console.log(e.name); // 'MyError' console.log(e.message); // 'Default Message' } try { throw new MyError('custom message'); } catch (e) { console.log(e.name); // 'MyError' console.log(e.message); // 'custom message' }
Sorry, something went wrong.
No branches or pull requests
参考资料
The text was updated successfully, but these errors were encountered: