mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Reduce usage of exceptions from Boot (#2373)
* wip * make pretty * Remove CRT version check from IM * fix * Simplify IsDebuggerPresent hook
This commit is contained in:
parent
f613b177a2
commit
9092e36b33
16 changed files with 494 additions and 295 deletions
42
Dalamud.Boot/error_info.h
Normal file
42
Dalamud.Boot/error_info.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#pragma once
|
||||
|
||||
#include <expected>
|
||||
#include <string>
|
||||
|
||||
typedef unsigned long DWORD;
|
||||
typedef _Return_type_success_(return >= 0) long HRESULT;
|
||||
|
||||
enum class DalamudBootErrorDescription {
|
||||
None,
|
||||
ModulePathResolutionFail,
|
||||
ModuleResourceLoadFail,
|
||||
ModuleResourceVersionReadFail,
|
||||
ModuleResourceVersionSignatureFail,
|
||||
};
|
||||
|
||||
class DalamudBootError {
|
||||
DalamudBootErrorDescription m_dalamudErrorDescription;
|
||||
long m_hresult;
|
||||
|
||||
public:
|
||||
DalamudBootError(DalamudBootErrorDescription dalamudErrorDescription, long hresult) noexcept;
|
||||
DalamudBootError(DalamudBootErrorDescription dalamudErrorDescription) noexcept;
|
||||
|
||||
const char* describe() const;
|
||||
|
||||
operator HRESULT() const {
|
||||
return m_hresult;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
using DalamudExpected = std::expected<
|
||||
std::conditional_t<
|
||||
std::is_reference_v<T>,
|
||||
std::reference_wrapper<std::remove_reference_t<T>>,
|
||||
T
|
||||
>,
|
||||
DalamudBootError
|
||||
>;
|
||||
|
||||
using DalamudUnexpected = std::unexpected<DalamudBootError>;
|
||||
Loading…
Add table
Add a link
Reference in a new issue