1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-26 11:41:15 +02:00

Make abort() call sites log first

This commit is contained in:
Robert Hensing 2024-07-20 22:46:09 +02:00
parent e48e0cbab0
commit 3172e88af5
35 changed files with 88 additions and 45 deletions

View file

@ -430,4 +430,16 @@ std::ostream & showErrorInfo(std::ostream & out, const ErrorInfo & einfo, bool s
return out;
}
void panic(std::string_view msg)
{
printError(msg);
printError("This was a fatal error, aborting.");
abort();
}
void panic(const char * file, int line, const char * func)
{
panic(std::string("Unexpected condition in ") + func + " at " + file + ":" + std::to_string(line));
}
}