error.js 432 B

12345678910111213141516171819
  1. /**
  2. * @class UniCloudError 错误处理模块
  3. */
  4. module.exports = class UniCloudError extends Error {
  5. constructor (options) {
  6. super(options.message)
  7. this.errMsg = options.message || ''
  8. Object.defineProperties(this, {
  9. message: {
  10. get () {
  11. return `errCode: ${options.code || ''} | errMsg: ` + this.errMsg
  12. },
  13. set (msg) {
  14. this.errMsg = msg
  15. }
  16. }
  17. })
  18. }
  19. }