errors.d.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /**
  2. * @fileoverview Common error classes
  3. * @author Nicholas C. Zakas
  4. */
  5. /**
  6. * Error thrown when a file or directory is not found.
  7. */
  8. export class NotFoundError extends Error {
  9. /**
  10. * Creates a new instance.
  11. * @param {string} message The error message.
  12. */
  13. constructor(message: string);
  14. /**
  15. * Error code.
  16. * @type {string}
  17. */
  18. code: string;
  19. }
  20. /**
  21. * Error thrown when an operation is not permitted.
  22. */
  23. export class PermissionError extends Error {
  24. /**
  25. * Creates a new instance.
  26. * @param {string} message The error message.
  27. */
  28. constructor(message: string);
  29. /**
  30. * Error code.
  31. * @type {string}
  32. */
  33. code: string;
  34. }
  35. /**
  36. * Error thrown when an operation is not allowed on a directory.
  37. */
  38. export class DirectoryError extends Error {
  39. /**
  40. * Creates a new instance.
  41. * @param {string} message The error message.
  42. */
  43. constructor(message: string);
  44. /**
  45. * Error code.
  46. * @type {string}
  47. */
  48. code: string;
  49. }
  50. /**
  51. * Error thrown when a directory is not empty.
  52. */
  53. export class NotEmptyError extends Error {
  54. /**
  55. * Creates a new instance.
  56. * @param {string} message The error message.
  57. */
  58. constructor(message: string);
  59. /**
  60. * Error code.
  61. * @type {string}
  62. */
  63. code: string;
  64. }