You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

errors.js 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. "use strict";
  2. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  3. if (k2 === undefined) k2 = k;
  4. Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
  5. }) : (function(o, m, k, k2) {
  6. if (k2 === undefined) k2 = k;
  7. o[k2] = m[k];
  8. }));
  9. var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
  10. Object.defineProperty(o, "default", { enumerable: true, value: v });
  11. }) : function(o, v) {
  12. o["default"] = v;
  13. });
  14. var __importStar = (this && this.__importStar) || function (mod) {
  15. if (mod && mod.__esModule) return mod;
  16. var result = {};
  17. if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  18. __setModuleDefault(result, mod);
  19. return result;
  20. };
  21. Object.defineProperty(exports, "__esModule", { value: true });
  22. exports.XRPLFaucetError = exports.LedgerVersionError = exports.MissingLedgerHistoryError = exports.PendingLedgerVersionError = exports.NotFoundError = exports.ValidationError = exports.ResponseFormatError = exports.TimeoutError = exports.RippledNotInitializedError = exports.DisconnectedError = exports.NotConnectedError = exports.RippledError = exports.ConnectionError = exports.UnexpectedError = exports.RippleError = void 0;
  23. const util_1 = require("util");
  24. const browserHacks = __importStar(require("./browser-hacks"));
  25. class RippleError extends Error {
  26. constructor(message = '', data) {
  27. super(message);
  28. this.name = browserHacks.getConstructorName(this);
  29. this.message = message;
  30. this.data = data;
  31. if (Error.captureStackTrace) {
  32. Error.captureStackTrace(this, this.constructor);
  33. }
  34. }
  35. toString() {
  36. let result = '[' + this.name + '(' + this.message;
  37. if (this.data) {
  38. result += ', ' + util_1.inspect(this.data);
  39. }
  40. result += ')]';
  41. return result;
  42. }
  43. inspect() {
  44. return this.toString();
  45. }
  46. }
  47. exports.RippleError = RippleError;
  48. class RippledError extends RippleError {
  49. }
  50. exports.RippledError = RippledError;
  51. class UnexpectedError extends RippleError {
  52. }
  53. exports.UnexpectedError = UnexpectedError;
  54. class LedgerVersionError extends RippleError {
  55. }
  56. exports.LedgerVersionError = LedgerVersionError;
  57. class ConnectionError extends RippleError {
  58. }
  59. exports.ConnectionError = ConnectionError;
  60. class NotConnectedError extends ConnectionError {
  61. }
  62. exports.NotConnectedError = NotConnectedError;
  63. class DisconnectedError extends ConnectionError {
  64. }
  65. exports.DisconnectedError = DisconnectedError;
  66. class RippledNotInitializedError extends ConnectionError {
  67. }
  68. exports.RippledNotInitializedError = RippledNotInitializedError;
  69. class TimeoutError extends ConnectionError {
  70. }
  71. exports.TimeoutError = TimeoutError;
  72. class ResponseFormatError extends ConnectionError {
  73. }
  74. exports.ResponseFormatError = ResponseFormatError;
  75. class ValidationError extends RippleError {
  76. }
  77. exports.ValidationError = ValidationError;
  78. class XRPLFaucetError extends RippleError {
  79. }
  80. exports.XRPLFaucetError = XRPLFaucetError;
  81. class NotFoundError extends RippleError {
  82. constructor(message = 'Not found') {
  83. super(message);
  84. }
  85. }
  86. exports.NotFoundError = NotFoundError;
  87. class MissingLedgerHistoryError extends RippleError {
  88. constructor(message) {
  89. super(message || 'Server is missing ledger history in the specified range');
  90. }
  91. }
  92. exports.MissingLedgerHistoryError = MissingLedgerHistoryError;
  93. class PendingLedgerVersionError extends RippleError {
  94. constructor(message) {
  95. super(message ||
  96. "maxLedgerVersion is greater than server's most recent" +
  97. ' validated ledger');
  98. }
  99. }
  100. exports.PendingLedgerVersionError = PendingLedgerVersionError;
  101. //# sourceMappingURL=errors.js.map