code: function handleError(err, pattern, options) {
    var message = err;
    if (typeof err === 'string') {
      err = new Error(message.trim());
      err.pattern = pattern;
      err.options = options;
      if (/invalid shell option/.test(err)) {
        err.code = 'INVALID_SHELL_OPTION';
      }
      if (/no match:/.test(err)) {
        err.code = 'NOMATCH';
      }
      return err;
    }
  
    if (err && (err.code === 'ENOENT' || err.code === 'NOMATCH')) {
      if (options.nullglob === true) {
        return [pattern];
      }
      if (options.failglob === true) {
        return err;
      }
      return [];
    }
    return err;
  }
docs: Handle errors to ensure the correct value is returned based on options