WindowsApiException.cs
1 using System; 2 using System.Runtime.Versioning; 3 4 namespace Ryujinx.Memory.WindowsShared 5 { 6 [SupportedOSPlatform("windows")] 7 class WindowsApiException : Exception 8 { 9 public WindowsApiException() 10 { 11 } 12 13 public WindowsApiException(string functionName) : base(CreateMessage(functionName)) 14 { 15 } 16 17 public WindowsApiException(string functionName, Exception inner) : base(CreateMessage(functionName), inner) 18 { 19 } 20 21 private static string CreateMessage(string functionName) 22 { 23 return $"{functionName} returned error code 0x{WindowsApi.GetLastError():X}."; 24 } 25 } 26 }