MCRO
C++23 utilities for Unreal Engine.
Loading...
Searching...
No Matches
WindowsError.h
Go to the documentation of this file.
1/** @noop License Comment
2 * @file
3 * @copyright
4 * This Source Code is subject to the terms of the Mozilla Public License, v2.0.
5 * If a copy of the MPL was not distributed with this file You can obtain one at
6 * https://mozilla.org/MPL/2.0/
7 *
8 * @author David Mórász
9 * @date 2025
10 */
11
12#pragma once
13
14#include "CoreMinimal.h"
15#include "Mcro/Error.h"
16
18{
19 using namespace Mcro::Error;
20
21 /**
22 * An error wrapping the returned code of GetLastError and attempts to get a string description of it
23 */
24 MCROWINDOWS_API class FLastError : public IError
25 {
26 public:
27 FLastError(int32 errorCode);
28
29 /** The result code wrapped by this error */
30 int32 ErrorCode;
31
32 /** The message what the Windows API communicates to us */
34 };
35
36 /**
37 * An error wrapping HRESULT code returned by many Microsoft APIs. It will also collect human readable metadata.
38 */
39 MCROWINDOWS_API class FHresultError : public IError
40 {
41 public:
42 /**
43 * @param result The input HRESULT
44 *
45 * @param fastMode
46 * Set it true to not gather human readable information about the error and just display the HRESULT code as is.
47 * Use it only in cursed situations where something may fail very often but it still needs a full IError
48 * somehow. Or just avoid such cursed situations in the first place.
49 */
50 FHresultError(HRESULT result, bool fastMode = false);
51
53
54 /** The result code wrapped by this error */
55 HRESULT Result;
56
57 /** The message what the Windows API communicates to us */
59
60 /** Stores the language-dependent programmatic ID (ProgID) for the class or application that raised the error. */
61 FString ProgramID;
62
63 /** A textual description of the error (might be different from Message) */
64 FString Description;
65 };
66}
FHresultError(HRESULT result, bool fastMode=false)