aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Memory/WindowsShared/WindowsApiException.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Memory/WindowsShared/WindowsApiException.cs')
-rw-r--r--Ryujinx.Memory/WindowsShared/WindowsApiException.cs24
1 files changed, 24 insertions, 0 deletions
diff --git a/Ryujinx.Memory/WindowsShared/WindowsApiException.cs b/Ryujinx.Memory/WindowsShared/WindowsApiException.cs
new file mode 100644
index 00000000..3140d705
--- /dev/null
+++ b/Ryujinx.Memory/WindowsShared/WindowsApiException.cs
@@ -0,0 +1,24 @@
+using System;
+
+namespace Ryujinx.Memory.WindowsShared
+{
+ class WindowsApiException : Exception
+ {
+ public WindowsApiException()
+ {
+ }
+
+ public WindowsApiException(string functionName) : base(CreateMessage(functionName))
+ {
+ }
+
+ public WindowsApiException(string functionName, Exception inner) : base(CreateMessage(functionName), inner)
+ {
+ }
+
+ private static string CreateMessage(string functionName)
+ {
+ return $"{functionName} returned error code 0x{WindowsApi.GetLastError():X}.";
+ }
+ }
+} \ No newline at end of file