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

Commit

Permalink
fix: handle missing daemon errors
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Nov 23, 2016
1 parent a131ffd commit 41c8153
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/files-api/files-api.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict'

var ipfs = require('../src')('localhost', 5001)
var ipfs = require('../../src')('localhost', 5001)

ipfs.files.ls('/folder1', function (err, res) {
if (err) {
return console.log(err)
return console.log('got an error', err)
}
if (res.readable) {
res.pipe(process.stdout)
Expand Down
4 changes: 4 additions & 0 deletions src/request-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ function requestAPI (config, options, callback) {
headers: headers
}, onRes(options.buffer, callback))

req.on('error', (err) => {
callback(err)
})

if (options.files) {
stream.pipe(req)
} else {
Expand Down

0 comments on commit 41c8153

Please sign in to comment.