From df267bc370d157b3d7a20e8ffccdcb74b8655012 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 25 May 2013 11:24:01 +0200 Subject: [PATCH] Include source/sink details in exceptions. --- src/main/java/net/pterodactylus/sonitus/data/Pipeline.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/pterodactylus/sonitus/data/Pipeline.java b/src/main/java/net/pterodactylus/sonitus/data/Pipeline.java index 93648bc..b45d346 100644 --- a/src/main/java/net/pterodactylus/sonitus/data/Pipeline.java +++ b/src/main/java/net/pterodactylus/sonitus/data/Pipeline.java @@ -261,7 +261,12 @@ public class Pipeline { try { final Metadata lastMetadata = firstMetadata; final Metadata metadata = firstMetadata = source.metadata(); - final byte[] buffer = source.get(4096); + final byte[] buffer; + try { + buffer = source.get(4096); + } catch (IOException ioe1) { + throw new IOException(String.format("I/O error while reading from %s.", source), ioe1); + } List> futures = executorService.invokeAll(FluentIterable.from(sinks).transform(new Function>() { @Override @@ -273,7 +278,11 @@ public class Pipeline { if (!metadata.equals(lastMetadata)) { sink.metadataUpdated(metadata); } - sink.process(buffer); + try { + sink.process(buffer); + } catch (IOException ioe1) { + throw new IOException(String.format("I/O error while writing to %s", sink), ioe1); + } return null; } }; -- 2.7.4