Skip to content

Commit 86dbf1a

Browse files
committed
More helpful error message if daemon is offline
1 parent b36d020 commit 86dbf1a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/java/org/ipfs/api/IPFS.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,8 +439,10 @@ private static byte[] get(URL target) throws IOException {
439439
while ((r = in.read(buf)) >= 0)
440440
resp.write(buf, 0, r);
441441
return resp.toByteArray();
442+
} catch (ConnectException e) {
443+
throw new RuntimeException("Couldn't connect to IPFS daemon at "+target+"\n Is IPFS running?");
442444
} catch (IOException e) {
443-
throw new RuntimeException("Trailer: " + conn.getHeaderFields().get("Trailer"), e);
445+
throw new RuntimeException("IOException contacting IPFS daemon.\nTrailer: " + conn.getHeaderFields().get("Trailer"), e);
444446
}
445447
}
446448

0 commit comments

Comments
 (0)