WindowsApiException.cs 595 B

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