aboutsummaryrefslogtreecommitdiff
path: root/dotnet/Mammoth/Couscous/mammoth/internal/util/PassThroughException.cs
blob: 4bd2a2a3f780c2e234ae609557aec3f365d1cc94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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<T>(SupplierWithException<T, IOException> supplier) {
			try {
				return supplier.get();
			} catch (IOException exception) {
				throw new PassThroughException(exception);
			}
		}
    
		private readonly IOException _exception;
		
		internal PassThroughException(IOException exception) {
			_exception = exception;
		}
	}
}