listr-error.interface.d.ts 1.3 KB

1234567891011121314151617181920212223242526272829
  1. import { ListrRendererFactory } from './renderer.interface';
  2. import { Task } from '../lib/task';
  3. /** The internal error handling mechanism.. */
  4. export declare class ListrError<Ctx extends Record<PropertyKey, any> = Record<PropertyKey, any>> extends Error {
  5. error: Error;
  6. type?: ListrErrorTypes;
  7. ctx?: Ctx;
  8. task?: Task<Ctx, ListrRendererFactory>;
  9. constructor(error: Error, type?: ListrErrorTypes, ctx?: Ctx, task?: Task<Ctx, ListrRendererFactory>);
  10. }
  11. /**
  12. * The actual error type that is collected and to help identify where the error is triggered from.
  13. */
  14. export declare enum ListrErrorTypes {
  15. /** Task has failed and will try to retry. */
  16. WILL_RETRY = "WILL_RETRY",
  17. /** Task has failed and will try to rollback. */
  18. WILL_ROLLBACK = "WILL_ROLLBACK",
  19. /** Task has failed, ran the rollback action but the rollback action itself has failed. */
  20. HAS_FAILED_TO_ROLLBACK = "HAS_FAILED_TO_ROLLBACK",
  21. /** Task has failed. */
  22. HAS_FAILED = "HAS_FAILED",
  23. /** Task has failed, but exitOnError is set to false, so will ignore this error. */
  24. HAS_FAILED_WITHOUT_ERROR = "HAS_FAILED_WITHOUT_ERROR"
  25. }
  26. /** The internal error handling mechanism for prompts only. */
  27. export declare class PromptError extends Error {
  28. constructor(message: string);
  29. }