What exactly is happening and how does one handle a scenarios like this to actually see/debug the exception?
public class Sample {
public static void main(String[] args) throws IOException{
ActorSystem system = ActorSystem.create("system");
ActorMaterializer mat = ActorMaterializer.create(system);
Source<ByteString, CompletionStage<IOResult>> source = FileIO.fromFile(new File("blah.txt"));
Sink<ByteString, CompletionStage<IOResult>> sink = FileIO.toFile(new File("c:\\temp\\blah.txt.copy"));
RunnableGraph<CompletionStage<IOResult>> runnableGraph = source.to(sink);
//RunnableGraph<CompletionStage<IOResult>> runnableGraph1 = source.toMat(sink, Keep.left());
//RunnableGraph<CompletionStage<IOResult>> runnableGraph2 = source.toMat(sink, Keep.right());
//RunnableGraph<Pair<CompletionStage<IOResult>, CompletionStage<IOResult>>> pairRunnableGraph = source.toMat(sink, Keep.both());
final CompletionStage<IOResult> cs = runnableGraph.run(mat).handle((x, t) -> {
if(t!=null){
System.out.println("Error: " + t);
}
if (x!=null){
String s = String.format("%s , %l bytes read",x.status(),x.count());
System.out.println(s);
}
return null;
});