aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Memory/WindowsShared/WindowsApiException.cs
blob: 308006aba3d87743558d4f9a78ba4a488936bb5f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using System;
using System.Runtime.Versioning;

namespace Ryujinx.Memory.WindowsShared
{
    [SupportedOSPlatform("windows")]
    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}.";
        }
    }
}