listr-error.interface.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.PromptError = exports.ListrErrorTypes = exports.ListrError = void 0;
  4. /** The internal error handling mechanism.. */
  5. class ListrError extends Error {
  6. constructor(error, type, ctx, task) {
  7. super(error.message);
  8. this.error = error;
  9. this.type = type;
  10. this.ctx = ctx;
  11. this.task = task;
  12. this.stack = error === null || error === void 0 ? void 0 : error.stack;
  13. this.name = 'ListrError';
  14. }
  15. }
  16. exports.ListrError = ListrError;
  17. /**
  18. * The actual error type that is collected and to help identify where the error is triggered from.
  19. */
  20. var ListrErrorTypes;
  21. (function (ListrErrorTypes) {
  22. /** Task has failed and will try to retry. */
  23. ListrErrorTypes["WILL_RETRY"] = "WILL_RETRY";
  24. /** Task has failed and will try to rollback. */
  25. ListrErrorTypes["WILL_ROLLBACK"] = "WILL_ROLLBACK";
  26. /** Task has failed, ran the rollback action but the rollback action itself has failed. */
  27. ListrErrorTypes["HAS_FAILED_TO_ROLLBACK"] = "HAS_FAILED_TO_ROLLBACK";
  28. /** Task has failed. */
  29. ListrErrorTypes["HAS_FAILED"] = "HAS_FAILED";
  30. /** Task has failed, but exitOnError is set to false, so will ignore this error. */
  31. ListrErrorTypes["HAS_FAILED_WITHOUT_ERROR"] = "HAS_FAILED_WITHOUT_ERROR";
  32. })(ListrErrorTypes = exports.ListrErrorTypes || (exports.ListrErrorTypes = {}));
  33. /** The internal error handling mechanism for prompts only. */
  34. class PromptError extends Error {
  35. constructor(message) {
  36. super(message);
  37. this.name = 'PromptError';
  38. }
  39. }
  40. exports.PromptError = PromptError;