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

Commit 7af843f

Browse files
richardschneiderdaviddias
authored andcommitted
fix: throw in pipe is bad
Use .emit('error', err)
1 parent 8e58225 commit 7af843f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

test/ipfs-factory/client.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ function Factory () {
3131
spawnNode()
3232
} else {
3333
ioC = io.connect(sioUrl, sioOptions)
34+
ioC.once('error', callback)
3435
ioC.once('connect_error', callback)
3536
ioC.once('connect', () => {
3637
sioConnected = true

test/ipfs-factory/server-routes.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const DaemonSpawner = require('./daemon-spawner')
66
module.exports = (http) => {
77
const io = new SocketIO(http.listener)
88
io.on('connection', handle)
9+
io.on('error', (err) => this.emit('error', err))
910

1011
const ds = new DaemonSpawner()
1112

@@ -17,7 +18,7 @@ module.exports = (http) => {
1718
function spawnNode (repoPath, config) {
1819
ds.spawnNode(repoPath, config, (err, apiAddr) => {
1920
if (err) {
20-
throw err
21+
return this.emit('error', err);
2122
}
2223
this.emit('fc-node', apiAddr.toString())
2324
})
@@ -26,7 +27,7 @@ module.exports = (http) => {
2627
function dismantle () {
2728
ds.dismantle((err) => {
2829
if (err) {
29-
throw err
30+
return this.emit('error', err);
3031
}
3132
this.emit('fc-nodes-shutdown')
3233
})

0 commit comments

Comments
 (0)