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

Commit 41c8153

Browse files
committed
fix: handle missing daemon errors
1 parent a131ffd commit 41c8153

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

examples/files-api/files-api.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
'use strict'
22

3-
var ipfs = require('../src')('localhost', 5001)
3+
var ipfs = require('../../src')('localhost', 5001)
44

55
ipfs.files.ls('/folder1', function (err, res) {
66
if (err) {
7-
return console.log(err)
7+
return console.log('got an error', err)
88
}
99
if (res.readable) {
1010
res.pipe(process.stdout)

src/request-api.js

+4
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,10 @@ function requestAPI (config, options, callback) {
147147
headers: headers
148148
}, onRes(options.buffer, callback))
149149

150+
req.on('error', (err) => {
151+
callback(err)
152+
})
153+
150154
if (options.files) {
151155
stream.pipe(req)
152156
} else {

0 commit comments

Comments
 (0)