mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-17 16:10:49 +01:00
Core/Common: Allow to show a message when aborting
Add a new ABORT_MSG macro that allows to show a formatted message before stopping the executable
(cherry picked from commit 0ddee8a4a0)
This commit is contained in:
@@ -127,6 +127,20 @@ void Abort(char const* file, int line, char const* function)
|
||||
Crash(formattedMessage.c_str());
|
||||
}
|
||||
|
||||
void Abort(char const* file, int line, char const* function, char const* message, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, message);
|
||||
|
||||
std::string formattedMessage = StringFormat("\n%s:%i in %s ABORTED:\n", file, line, function) + FormatAssertionMessage(message, args) + '\n';
|
||||
va_end(args);
|
||||
|
||||
fprintf(stderr, "%s", formattedMessage.c_str());
|
||||
fflush(stderr);
|
||||
|
||||
Crash(formattedMessage.c_str());
|
||||
}
|
||||
|
||||
void AbortHandler(int sigval)
|
||||
{
|
||||
// nothing useful to log here, no way to pass args
|
||||
|
||||
Reference in New Issue
Block a user