Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
fix: check for repo uninitialized error
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobheun authored and daviddias committed May 30, 2018
1 parent d582896 commit dcf5ea5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@
"ipfs-block": "~0.7.1",
"ipfs-block-service": "~0.14.0",
"ipfs-multipart": "~0.1.0",
"ipfs-repo": "github:ipfs/js-ipfs-repo#fix/node10",
"ipfs-repo": "~0.22.0",
"ipfs-unixfs": "~0.1.14",
"ipfs-unixfs-engine": "~0.29.0",
"ipld": "github:ipld/js-ipld#fix/node10",
"ipld": "~0.17.1",
"ipld-dag-cbor": "~0.12.0",
"ipld-dag-pb": "~0.14.4",
"is-ipfs": "~0.3.2",
Expand Down
10 changes: 9 additions & 1 deletion src/core/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const waterfall = require('async/waterfall')
const series = require('async/series')
const extend = require('deep-extend')
const RepoErrors = require('ipfs-repo/src/errors')

// Boot an IPFS node depending on the options set
module.exports = (self) => {
Expand Down Expand Up @@ -40,7 +41,14 @@ module.exports = (self) => {
// which happens when the version file is not found
// we just want to signal that no repo exist, not
// fail the whole process.
// TODO: improve datastore and ipfs-repo implemenations so this error is a bit more unified

// Use standardized errors as much as possible
if (err.code === RepoErrors.ERR_REPO_NOT_INITIALIZED) {
return cb(null, false)
}

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

0 comments on commit dcf5ea5

Please sign in to comment.