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

Commit c755dde

Browse files
committed
fix: better repo.gc() response handling
1 parent 2261874 commit c755dde

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/repo/gc.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
const promisify = require('promisify-es6')
44
const streamToValueWithTransformer = require('../utils/stream-to-value-with-transformer')
5+
const CID = require('cids')
56

67
const transform = function (res, callback) {
78
callback(null, res.map(r => ({
8-
err: r.Err,
9-
cid: (r.Key || {})['/']
9+
err: r.Err ? new Error(r.Err) : null,
10+
cid: r.Key ? new CID(r.Key) : null
1011
})))
1112
}
1213

0 commit comments

Comments
 (0)