CppCommon 1.0.5.0
C++ Common Library
Loading...
Searching...
No Matches
fatal.cpp
Go to the documentation of this file.
1
9#include "errors/fatal.h"
10
11#include <cstdlib>
12#include <iostream>
13
14namespace CppCommon {
15
16void fatal(const SourceLocation& location, const StackTrace& trace, const std::string& message, int error) noexcept
17{
18 std::cerr << "Fatal error: " << message << std::endl;
19 std::cerr << "System error: " << error << std::endl;
20 std::cerr << "System message: " << SystemError::Description(error) << std::endl;
21 std::cerr << "Source location: " << location.string() << std::endl;
22 std::cerr << "Stack trace: " << std::endl << trace.string() << std::endl;
23 std::abort();
24}
25
26void fatal(const SourceLocation& location, const StackTrace& trace, const std::exception& fatal) noexcept
27{
28 std::cerr << fatal.what() << std::endl;
29 std::abort();
30}
31
32} // namespace CppCommon
Stack trace snapshot provider.
Definition stack_trace.h:33
static std::string Description()
Convert the last system error code to the system error description.
Fatal abort execution definition.
C++ Common project definitions.
void fatal(const SourceLocation &location, const StackTrace &trace, const std::string &message, int error=SystemError::GetLast()) noexcept
Fatal abort execution.
Definition fatal.cpp:16