How to use the ipfs-repo.errors.ERR_REPO_NOT_INITIALIZED function in ipfs-repo

To help you get started, we’ve selected a few ipfs-repo 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 ipfs / js-ipfs / src / core / boot.js View on Github external
function isRepoUninitializedError (err) {
  // If the error is that no repo exists,
  // which happens when the version file is not found
  // we just want to signal that no repo exist, not
  // fail the whole process.

  // Use standardized errors as much as possible
  if (err.code === RepoErrors.ERR_REPO_NOT_INITIALIZED) {
    return true
  }

  // TODO: As error codes continue to be standardized, this logic can be phase out;
  // it is here to maintain compatibility
  if (err.message.match(/not found/) || // indexeddb
    err.message.match(/ENOENT/) || // fs
    err.message.match(/No value/) // memory
  ) {
    return true
  }

  return false
}

ipfs-repo

IPFS Repo implementation

Apache-2.0 OR MIT
Latest version published 2 years ago

Package Health Score

48 / 100
Full package analysis