eis/mix_cc/exception/exception.h

51 lines
1.1 KiB
C
Raw Normal View History

/**
* @file mix_cc/exception/exception.h
* @brief mix_cc的异常类
* @author Cat (null.null.null@qq.com)
* @version 0.1
* @date 2021-09-17
*
* Copyright: Baosight Co. Ltd.
* DO NOT COPY/USE WITHOUT PERMISSION
*
*/
#pragma once
#include "mix_cc/json.h"
#include <exception>
#include <string>
#include <thread>
#include <boost/assert/source_location.hpp>
namespace mix_cc {
/**
* @brief mix_cc内部的异常处理类
*/
class Exception : public std::runtime_error {
public:
/**
* @brief mix_cc内部的异常处理类
* @param error_code (int)
* @param error_info (string)
* @param src_loc
* @param extra_info
*/
Exception(int error_code, const std::string error_info,
const boost::source_location src_loc, const json extra_info_ = {});
/**
* @brief Destroy the Exception object
*/
~Exception();
/**
* @brief Get the thread name object
* @return std::string
*/
size_t get_thread_id() const;
protected:
std::thread::id thread_id_;
};
} // namespace mix_cc