noFilesFoundError.js 400 B

1234567891011121314151617181920
  1. 'use strict';
  2. class NoFilesFoundError extends Error {
  3. /**
  4. * @param {string|string[]} fileList
  5. */
  6. constructor(fileList) {
  7. super();
  8. if (typeof fileList === 'string') {
  9. fileList = [fileList];
  10. }
  11. const pattern = fileList.filter((i) => !i.startsWith('!')).join(', ');
  12. this.message = `No files matching the pattern "${pattern}" were found.`;
  13. }
  14. }
  15. module.exports = NoFilesFoundError;