How to use the @verdaccio/commons-api/lib.getInternalError function in @verdaccio/commons-api

To help you get started, we’ve selected a few @verdaccio/commons-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github verdaccio / local-storage / src / local-fs.ts View on Github external
}
      };

      if (!err) {
        locked = true;
        this.logger.trace(
          {
            name
          },
          '[local-storage/updatePackage] file: @{name} has been locked'
        );
      }

      if (_.isNil(err) === false) {
        if (err.code === resourceNotAvailable) {
          return unLockCallback(getInternalError('resource temporarily unavailable'));
        } else if (err.code === noSuchFile) {
          return unLockCallback(getNotFound());
        } else {
          return unLockCallback(err);
        }
      }

      updateHandler(json, err => {
        if (err) {
          return unLockCallback(err);
        }

        onWrite(name, transformPackage(json), unLockCallback);
      });
    });
  }
github verdaccio / local-storage / src / local-database.ts View on Github external
this.get((err, data) => {
      if (err) {
        cb(getInternalError('error remove private package'));
        this.logger.error({ err }, '[local-storage/remove]: remove the private package has failed @{err}');
      }

      const pkgName = data.indexOf(name);
      if (pkgName !== -1) {
        this.data.list.splice(pkgName, 1);

        this.logger.trace({ name }, 'local-storage: [remove] package @{name} has been removed');
      }

      cb(this._sync());
    });
  }