eis/mix_cc/exception/get_nested_exception.h

34 lines
983 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* @file mix_cc/exception/get_nested_exception.h
* @brief 把expection格式化
* @author Cat (null.null.null@qq.com)
* @version 0.1
* @date 2021-05-07
*
* Copyright: Baosight Co. Ltd.
* DO NOT COPY/USE WITHOUT PERMISSION
*
*/
#pragma once
#include <mix_cc/json.h>
#include <exception>
#include <string>
namespace mix_cc {
/**
* @brief 获取嵌套的mix_cc异常
* @param e 异常可以是普通异常或mix_cc异常
* @param level 不需要提供的参数,用于控制当前嵌套的层数
* @return std::string
*/
std::string get_nested_exception(const std::exception& e, int level = 0);
/**
* @brief 获取嵌套的mix_cc异常,并以json形式返回
* @param e 异常可以是普通异常或mix_cc异常
* @param level 不需要提供的参数,用于控制当前嵌套的层数
* @return json
*/
json get_nested_exception_json(const std::exception& e, int level = 0);
} // namespace mix_cc