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

Commit a500c71

Browse files
committed
fix: check for repo uninitialized error
1 parent c3bc664 commit a500c71

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,10 @@
110110
"ipfs-block": "~0.7.1",
111111
"ipfs-block-service": "~0.14.0",
112112
"ipfs-multipart": "~0.1.0",
113-
"ipfs-repo": "github:ipfs/js-ipfs-repo#fix/node10",
113+
"ipfs-repo": "~0.22.0",
114114
"ipfs-unixfs": "~0.1.14",
115115
"ipfs-unixfs-engine": "~0.29.0",
116-
"ipld": "github:ipld/js-ipld#fix/node10",
116+
"ipld": "~0.17.1",
117117
"ipld-dag-cbor": "~0.12.0",
118118
"ipld-dag-pb": "~0.14.4",
119119
"is-ipfs": "~0.3.2",

src/core/boot.js

+9-1
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)