77 lines
1.8 KiB
C++
77 lines
1.8 KiB
C++
/***
|
|
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: SysPanic.hpp
|
|
Date: 2021-6-10
|
|
Author: Reece
|
|
***/
|
|
#pragma once
|
|
|
|
namespace Aurora
|
|
{
|
|
AUKN_SYM bool RuntimeHasStarted();
|
|
}
|
|
|
|
#if defined(_AUHAS_FMT)
|
|
template<typename ... T>
|
|
static inline void AU_NORETURN SysPanic(fmt::format_string<T...> msg, T&& ... args)
|
|
{
|
|
if (Aurora::RuntimeHasStarted())
|
|
{
|
|
Aurora::Debug::AddMemoryCrunch();
|
|
try
|
|
{
|
|
Aurora::Logging::WriteLinef(static_cast<AuUInt8>(Aurora::Logging::ELogLevel::eError), Aurora::Console::EAnsiColor::eBoldRed, "Fatal", msg, AuForward<T>(args)...);
|
|
}
|
|
catch (...)
|
|
{
|
|
|
|
}
|
|
}
|
|
Aurora::Debug::Panic();
|
|
}
|
|
|
|
template<typename ... T>
|
|
static inline void AU_NORETURN SysPanic2(AuUInt uLineHintInNonshipBinary,
|
|
fmt::format_string<T...> msg, T&& ... args)
|
|
{
|
|
if (Aurora::RuntimeHasStarted())
|
|
{
|
|
Aurora::Debug::AddMemoryCrunch();
|
|
try
|
|
{
|
|
Aurora::Logging::WriteLinef(static_cast<AuUInt8>(Aurora::Logging::ELogLevel::eError), Aurora::Console::EAnsiColor::eBoldRed, "Fatal", msg, AuForward<T>(args)...);
|
|
}
|
|
catch (...)
|
|
{
|
|
|
|
}
|
|
}
|
|
Aurora::Debug::Panic2(uLineHintInNonshipBinary);
|
|
}
|
|
|
|
template<typename ... T>
|
|
static inline void AU_NORETURN SysPanic()
|
|
{
|
|
Aurora::Debug::Panic();
|
|
}
|
|
|
|
template<typename ... T>
|
|
static inline void AU_NORETURN SysPanic2(AuUInt uLineHintInNonshipBinary)
|
|
{
|
|
Aurora::Debug::Panic2(uLineHintInNonshipBinary);
|
|
}
|
|
|
|
static inline AU_NORETURN void SysPanic(const char *pMsg)
|
|
{
|
|
SysPanic("{}", pMsg);
|
|
}
|
|
|
|
static inline AU_NORETURN void SysUnreachable_(int uLineHintInNonshipBinary)
|
|
{
|
|
Aurora::Debug::Panic2(uLineHintInNonshipBinary);
|
|
}
|
|
|
|
#define SysUnreachable() SysUnreachable_(SysSafeLine)
|
|
|
|
#endif |