aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Memory/WindowsShared/WindowsApiException.cs
blob: 330c1842a3dc386ad742e844964ca5630e460055 (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}.";
        }
    }
}