From 9094345875cc589915dc2c0371dbaa592dd7d713 Mon Sep 17 00:00:00 2001 From: Jeromy Date: Sun, 25 Oct 2015 13:15:14 -0700 Subject: [PATCH] make swarm connect return an error when it fails License: MIT Signed-off-by: Jeromy --- core/commands/swarm.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/commands/swarm.go b/core/commands/swarm.go index 884e33f7d59..badedaa7d37 100644 --- a/core/commands/swarm.go +++ b/core/commands/swarm.go @@ -237,10 +237,10 @@ ipfs swarm connect /ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3 err := n.PeerHost.Connect(ctx, pi) if err != nil { - output[i] += " failure: " + err.Error() - } else { - output[i] += " success" + res.SetError(fmt.Errorf("%s failure: %s", output[i], err), cmds.ErrNormal) + return } + output[i] += " success" } res.SetOutput(&stringList{output})