From 0f9ef005f063198ea2e16ca36beaead4bd5e3824 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Thu, 14 Apr 2016 21:12:07 +0100 Subject: Add .NET output --- .../mammoth/internal/util/PassThroughException.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 dotnet/Mammoth/Couscous/mammoth/internal/util/PassThroughException.cs (limited to 'dotnet/Mammoth/Couscous/mammoth/internal/util/PassThroughException.cs') diff --git a/dotnet/Mammoth/Couscous/mammoth/internal/util/PassThroughException.cs b/dotnet/Mammoth/Couscous/mammoth/internal/util/PassThroughException.cs new file mode 100644 index 0000000..4bd2a2a --- /dev/null +++ b/dotnet/Mammoth/Couscous/mammoth/internal/util/PassThroughException.cs @@ -0,0 +1,21 @@ +using Mammoth.Couscous.java.lang; +using Mammoth.Couscous.java.io; + +namespace Mammoth.Couscous.org.zwobble.mammoth.@internal.util { + internal class PassThroughException : RuntimeException { + internal static T wrap(SupplierWithException supplier) { + try { + return supplier.get(); + } catch (IOException exception) { + throw new PassThroughException(exception); + } + } + + private readonly IOException _exception; + + internal PassThroughException(IOException exception) { + _exception = exception; + } + } +} + -- cgit v1.2.3