Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Commit 52c465f

Browse files
authored
Merge pull request #10 from ipfs/fix/err-code
Fix/err code
2 parents c7cf68a + 64ff6a1 commit 52c465f

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
},
3838
"homepage": "https://github.com/ipfs/js-ipfs-mfs#readme",
3939
"devDependencies": {
40-
"aegir": "^15.0.0",
40+
"aegir": "^15.2.0",
4141
"chai": "^4.1.2",
4242
"detect-node": "^2.0.3",
4343
"detect-webworker": "^1.0.0",
@@ -54,7 +54,7 @@
5454
"debug": "^3.1.0",
5555
"file-api": "~0.10.4",
5656
"filereader-stream": "^2.0.0",
57-
"interface-datastore": "~0.4.2",
57+
"interface-datastore": "~0.5.0",
5858
"ipfs-unixfs": "~0.1.15",
5959
"ipfs-unixfs-engine": "~0.32.1",
6060
"is-pull-stream": "~0.0.0",

src/core/utils/with-mfs-root.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ const withMfsRoot = (ipfs, callback) => {
2222
(cb) => {
2323
// Load the MFS root CID
2424
datastore.get(MFS_ROOT_KEY, (error, result) => {
25-
if (error && error.notFound) {
25+
// Once datastore-level releases its error.code addition, we can remove error.notFound logic
26+
if (error && (error.notFound || error.code === 'ERR_NOT_FOUND')) {
2627
log('Creating new MFS root')
2728

2829
return waterfall([
@@ -38,7 +39,8 @@ const withMfsRoot = (ipfs, callback) => {
3839
], cb)
3940
}
4041

41-
cb(error, new CID(result))
42+
const cid = result ? new CID(result) : null
43+
cb(error, cid)
4244
})
4345
},
4446
// Turn the Buffer into a CID

0 commit comments

Comments
 (0)