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

Commit b149beb

Browse files
committed
fix: check for repo uninitialized error
1 parent d58716e commit b149beb

File tree

3 files changed

+12140
-3
lines changed

3 files changed

+12140
-3
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
},
6262
"homepage": "https://github.com/ipfs/js-ipfs#readme",
6363
"devDependencies": {
64-
"aegir": "^13.1.0",
64+
"aegir": "github:ipfs/aegir#upgrade-deps",
6565
"buffer-loader": "0.0.1",
6666
"chai": "^4.1.2",
6767
"delay": "^2.0.0",
@@ -73,7 +73,7 @@
7373
"expose-loader": "^0.7.5",
7474
"form-data": "^2.3.2",
7575
"hat": "0.0.3",
76-
"interface-ipfs-core": "~0.65.7",
76+
"interface-ipfs-core": "~0.66.0",
7777
"ipfsd-ctl": "github:ipfs/js-ipfsd-ctl#fix/node10",
7878
"lodash": "^4.17.10",
7979
"mocha": "^5.1.1",

src/core/boot.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const waterfall = require('async/waterfall')
44
const series = require('async/series')
55
const extend = require('deep-extend')
6+
const RepoErrors = require('ipfs-repo/src/errors')
67

78
// Boot an IPFS node depending on the options set
89
module.exports = (self) => {
@@ -40,7 +41,14 @@ module.exports = (self) => {
4041
// which happens when the version file is not found
4142
// we just want to signal that no repo exist, not
4243
// fail the whole process.
43-
// TODO: improve datastore and ipfs-repo implemenations so this error is a bit more unified
44+
45+
// Use standardized errors as much as possible
46+
if (err.code === RepoErrors.ERR_REPO_NOT_INITIALIZED) {
47+
return cb(null, false)
48+
}
49+
50+
// TODO: As error codes continue to be standardized, this logic can be phase out;
51+
// it is here to maintain compatability
4452
if (err.message.match(/not found/) || // indexeddb
4553
err.message.match(/ENOENT/) || // fs
4654
err.message.match(/No value/) // memory

0 commit comments

Comments
 (0)