AuroraRuntime/Include/Aurora/Debug/SysPanic.hpp

55 lines
1.3 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
#if defined(_AUHAS_FMT)
template<typename ... T>
static inline void AU_NORETURN SysPanic(T... args)
{
if constexpr (sizeof...(T) != 0)
{
Aurora::Debug::AddMemoryCrunch();
try
{
Aurora::Logging::WriteLinef(static_cast<AuUInt8>(Aurora::Logging::ELogLevel::eError), Aurora::Console::EAnsiColor::eBoldRed, "Fatal", AuForward<T>(args)...);
}
catch (...)
{
}
}
Aurora::Debug::Panic();
}
template<typename ... T>
static inline void AU_NORETURN SysPanic2(AuUInt uLineHintInNonshipBinary,
T... args)
{
if constexpr (sizeof...(T) != 0)
{
Aurora::Debug::AddMemoryCrunch();
try
{
Aurora::Logging::WriteLinef(static_cast<AuUInt8>(Aurora::Logging::ELogLevel::eError), Aurora::Console::EAnsiColor::eBoldRed, "Fatal", AuForward<T>(args)...);
}
catch (...)
{
}
}
Aurora::Debug::Panic2(uLineHintInNonshipBinary);
}
static inline AU_NORETURN void SysUnreachable_(int uLineHintInNonshipBinary)
{
Aurora::Debug::Panic2(uLineHintInNonshipBinary);
}
#define SysUnreachable() SysUnreachable_(SysSafeLine)
#endif