22 lines
833 B
C++
22 lines
833 B
C++
#include "mix_cc/exception/exception.h"
|
|
|
|
mix_cc::Exception::Exception(int error_code, const std::string error_info,
|
|
const boost::source_location src_loc,
|
|
const json extra_info)
|
|
: runtime_error(json{
|
|
{"file", std::string(src_loc.file_name()) + ":" +
|
|
std::to_string(src_loc.line())},
|
|
{"thread", std::hash<std::thread::id>{}(std::this_thread::get_id())},
|
|
{"func", std::string(src_loc.function_name())},
|
|
{"error_code", error_code},
|
|
{"error", error_info},
|
|
{"info",
|
|
extra_info}}.dump(4)),
|
|
thread_id_(std::this_thread::get_id()) {}
|
|
|
|
mix_cc::Exception::~Exception() {}
|
|
|
|
size_t mix_cc::Exception::get_thread_id() const {
|
|
return std::hash<std::thread::id>{}(this->thread_id_);
|
|
}
|