classZPErrorextendsError{ constructor ({ code, message }) { // Calling parent constrcutor of base Error class. super(message) // Capturing stack trace, excluding constructor call from it. Error.captureStackTrace && Error.captureStackTrace(this, this.constructor) // Saving class name in the property of our custom error as a shortcut. this.name = this.constructor.name // 自定义参数 this.code = code // 自定义参数 } }