wx_human_seg 3.0.0
wx_exception.h
Go to the documentation of this file.
1
5#ifndef WX_EXCEPTION_H_
6#define WX_EXCEPTION_H_
7
8#include <iostream>
9#include <exception>
10#include <string>
11#include "wx_api.h"
12
13namespace wonxai {
14
16class WX_API WXException : public std::exception {
17public:
18 explicit WXException(int err_code, const char *fmt, ...) noexcept;
19 ~WXException() noexcept override{};
20
25 int errCode() const;
26
31 const char* what() const noexcept override;
32
37 std::string toMsg();
38
39protected:
40 int err_code_;
41 std::string message_;
42};
43
44}
45
46#define WXRaiseExcept(errCode, msg, ...) throw wonxai::WXException(errCode, msg, ##__VA_ARGS__)
47
48#endif //WX_EXCEPTION_H_
49
Definition: wx_exception.h:16
int errCode() const
获取异常错误码
const char * what() const noexcept override
获取异常描述