From: David ‘Bombe’ Roden Date: Sat, 25 May 2013 09:24:01 +0000 (+0200) Subject: Include source/sink details in exceptions. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=df267bc370d157b3d7a20e8ffccdcb74b8655012;p=sonitus.git Include source/sink details in exceptions. --- 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; } };