Errors.js 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. /* eslint-disable
  2. max-len,
  3. no-proto,
  4. no-unused-vars,
  5. */
  6. // TODO: This file was created by bulk-decaffeinate.
  7. // Fix any style issues and re-enable lint.
  8. /*
  9. * decaffeinate suggestions:
  10. * DS207: Consider shorter variations of null checks
  11. * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
  12. */
  13. let Errors
  14. var NotFoundError = function(message) {
  15. const error = new Error(message)
  16. error.name = 'NotFoundError'
  17. error.__proto__ = NotFoundError.prototype
  18. return error
  19. }
  20. NotFoundError.prototype.__proto__ = Error.prototype
  21. var ForbiddenError = function(message) {
  22. const error = new Error(message)
  23. error.name = 'ForbiddenError'
  24. error.__proto__ = ForbiddenError.prototype
  25. return error
  26. }
  27. ForbiddenError.prototype.__proto__ = Error.prototype
  28. var ServiceNotConfiguredError = function(message) {
  29. const error = new Error(message)
  30. error.name = 'ServiceNotConfiguredError'
  31. error.__proto__ = ServiceNotConfiguredError.prototype
  32. return error
  33. }
  34. ServiceNotConfiguredError.prototype.__proto__ = Error.prototype
  35. var TooManyRequestsError = function(message) {
  36. const error = new Error(message)
  37. error.name = 'TooManyRequestsError'
  38. error.__proto__ = TooManyRequestsError.prototype
  39. return error
  40. }
  41. TooManyRequestsError.prototype.__proto__ = Error.prototype
  42. var InvalidNameError = function(message) {
  43. const error = new Error(message)
  44. error.name = 'InvalidNameError'
  45. error.__proto__ = InvalidNameError.prototype
  46. return error
  47. }
  48. InvalidNameError.prototype.__proto__ = Error.prototype
  49. var UnsupportedFileTypeError = function(message) {
  50. const error = new Error(message)
  51. error.name = 'UnsupportedFileTypeError'
  52. error.__proto__ = UnsupportedFileTypeError.prototype
  53. return error
  54. }
  55. UnsupportedFileTypeError.prototype.__proto__ = Error.prototype
  56. var UnsupportedExportRecordsError = function(message) {
  57. const error = new Error(message)
  58. error.name = 'UnsupportedExportRecordsError'
  59. error.__proto__ = UnsupportedExportRecordsError.prototype
  60. return error
  61. }
  62. UnsupportedExportRecordsError.prototype.__proto__ = Error.prototype
  63. var V1HistoryNotSyncedError = function(message) {
  64. const error = new Error(message)
  65. error.name = 'V1HistoryNotSyncedError'
  66. error.__proto__ = V1HistoryNotSyncedError.prototype
  67. return error
  68. }
  69. V1HistoryNotSyncedError.prototype.__proto__ = Error.prototype
  70. var ProjectHistoryDisabledError = function(message) {
  71. const error = new Error(message)
  72. error.name = 'ProjectHistoryDisabledError'
  73. error.__proto__ = ProjectHistoryDisabledError.prototype
  74. return error
  75. }
  76. ProjectHistoryDisabledError.prototype.__proto__ = Error.prototype
  77. var V1ConnectionError = function(message) {
  78. const error = new Error(message)
  79. error.name = 'V1ConnectionError'
  80. error.__proto__ = V1ConnectionError.prototype
  81. return error
  82. }
  83. V1ConnectionError.prototype.__proto__ = Error.prototype
  84. var UnconfirmedEmailError = function(message) {
  85. const error = new Error(message)
  86. error.name = 'UnconfirmedEmailError'
  87. error.__proto__ = UnconfirmedEmailError.prototype
  88. return error
  89. }
  90. UnconfirmedEmailError.prototype.__proto__ = Error.prototype
  91. var EmailExistsError = function(message) {
  92. const error = new Error(message)
  93. error.name = 'EmailExistsError'
  94. error.__proto__ = EmailExistsError.prototype
  95. return error
  96. }
  97. EmailExistsError.prototype.__proto__ = Error.prototype
  98. var InvalidError = function(message) {
  99. const error = new Error(message)
  100. error.name = 'InvalidError'
  101. error.__proto__ = InvalidError.prototype
  102. return error
  103. }
  104. InvalidError.prototype.__proto__ = Error.prototype
  105. var AccountMergeError = function(message) {
  106. const error = new Error(message)
  107. error.name = 'AccountMergeError'
  108. error.__proto__ = AccountMergeError.prototype
  109. return error
  110. }
  111. AccountMergeError.prototype.__proto__ = Error.prototype
  112. var NotInV2Error = function(message) {
  113. const error = new Error(message)
  114. error.name = 'NotInV2Error'
  115. error.__proto__ = NotInV2Error.prototype
  116. return error
  117. }
  118. NotInV2Error.prototype.__proto__ = Error.prototype
  119. var SLInV2Error = function(message) {
  120. const error = new Error(message)
  121. error.name = 'SLInV2Error'
  122. error.__proto__ = SLInV2Error.prototype
  123. return error
  124. }
  125. SLInV2Error.prototype.__proto__ = Error.prototype
  126. const ThirdPartyIdentityExistsError = function(message) {
  127. if (message == null) {
  128. message = 'provider and external id already linked to another account'
  129. }
  130. const error = new Error(message)
  131. error.name = 'ThirdPartyIdentityExistsError'
  132. error.__proto__ = ThirdPartyIdentityExistsError.prototype
  133. return error
  134. }
  135. ThirdPartyIdentityExistsError.prototype.__proto__ = Error.prototype
  136. const ThirdPartyUserNotFoundError = function(message) {
  137. if (message == null) {
  138. message = 'user not found for provider and external id'
  139. }
  140. const error = new Error(message)
  141. error.name = 'ThirdPartyUserNotFoundError'
  142. error.__proto__ = ThirdPartyUserNotFoundError.prototype
  143. return error
  144. }
  145. ThirdPartyUserNotFoundError.prototype.__proto__ = Error.prototype
  146. var SubscriptionAdminDeletionError = function(message) {
  147. if (message == null) {
  148. message = 'subscription admins cannot be deleted'
  149. }
  150. const error = new Error(message)
  151. error.name = 'SubscriptionAdminDeletionError'
  152. error.__proto__ = SubscriptionAdminDeletionError.prototype
  153. return error
  154. }
  155. SubscriptionAdminDeletionError.prototype.__proto__ = Error.prototype
  156. module.exports = Errors = {
  157. NotFoundError,
  158. ForbiddenError,
  159. ServiceNotConfiguredError,
  160. TooManyRequestsError,
  161. InvalidNameError,
  162. UnsupportedFileTypeError,
  163. UnsupportedExportRecordsError,
  164. V1HistoryNotSyncedError,
  165. ProjectHistoryDisabledError,
  166. V1ConnectionError,
  167. UnconfirmedEmailError,
  168. EmailExistsError,
  169. InvalidError,
  170. AccountMergeError,
  171. NotInV2Error,
  172. SLInV2Error,
  173. ThirdPartyIdentityExistsError,
  174. ThirdPartyUserNotFoundError,
  175. SubscriptionAdminDeletionError
  176. }