Source: watcher/WatcherError.js

  1. 'use strict';
  2. /**
  3. * @module watcher/WatcherError
  4. */
  5. var util = require('util');
  6. /**
  7. * Defines an error occurring while watching for directory changes.
  8. *
  9. * @class WatcherError
  10. * @extends Error
  11. * @constructor
  12. * @param {String} message The error message
  13. * @param {String} code The error code
  14. * @param {String} directoryPath The absolute path of the directory in error
  15. */
  16. function WatcherError(message, code, directoryPath) {
  17. Error.captureStackTrace(this, this.constructor);
  18. Object.defineProperties(this,
  19. /** @lends module:watcher/WatcherError~WatcherError */
  20. {
  21. /**
  22. * The fs.FSWatcher's error code.
  23. *
  24. * @instance
  25. * @readonly
  26. * @type {String}
  27. */
  28. code: {value: code},
  29. /**
  30. * The absolute path of the watched directory the error belongs to.
  31. *
  32. * @instance
  33. * @readonly
  34. * @type {String}
  35. */
  36. directoryPath: {value: directoryPath},
  37. /**
  38. * Error message.
  39. *
  40. * @instance
  41. * @type {String}
  42. */
  43. message: {value: message, writable: true},
  44. /**
  45. * Error name.
  46. *
  47. * @instance
  48. * @type {String}
  49. */
  50. name: {value: 'WatcherError', writable: true}
  51. }
  52. );
  53. }
  54. module.exports = WatcherError;
  55. util.inherits(WatcherError, Error);