aboutsummaryrefslogtreecommitdiff
path: root/dotnet/Mammoth/Couscous/mammoth/internal/util/PassThroughException.cs
diff options
context:
space:
mode:
Diffstat (limited to 'dotnet/Mammoth/Couscous/mammoth/internal/util/PassThroughException.cs')
-rw-r--r--dotnet/Mammoth/Couscous/mammoth/internal/util/PassThroughException.cs8
1 files changed, 8 insertions, 0 deletions
diff --git a/dotnet/Mammoth/Couscous/mammoth/internal/util/PassThroughException.cs b/dotnet/Mammoth/Couscous/mammoth/internal/util/PassThroughException.cs
index 4bd2a2a..88597e3 100644
--- a/dotnet/Mammoth/Couscous/mammoth/internal/util/PassThroughException.cs
+++ b/dotnet/Mammoth/Couscous/mammoth/internal/util/PassThroughException.cs
@@ -10,6 +10,14 @@ namespace Mammoth.Couscous.org.zwobble.mammoth.@internal.util {
throw new PassThroughException(exception);
}
}
+
+ internal static T unwrap<T>(SupplierWithException<T, IOException> supplier) {
+ try {
+ return supplier.get();
+ } catch (PassThroughException exception) {
+ throw exception._exception;
+ }
+ }
private readonly IOException _exception;