-
Notifications
You must be signed in to change notification settings - Fork 0
/
ch_except.h
44 lines (34 loc) · 1.04 KB
/
ch_except.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef ch_except_h__
#define ch_except_h__
/********************************************************************
created: 2014/08/13
created: 13:8:2014 19:35
filename: C:\prj\charlotte\src\ch_except.h
file path: C:\prj\charlotte\src
file base: ch_except
file ext: h
author: Yuri Volodine
purpose: Charlotte exception handling
*********************************************************************/
#include <assert.h>
#include <exception>
#include <string>
#include <boost/lexical_cast.hpp>
struct ch_unknown_exc : public std::exception
{
};
struct ch_cfg_exc : public std::exception
{
};
struct ch_module_exc : public std::exception
{
ch_module_exc() : _retval(0), _msg("Unexpected error!") {}
ch_module_exc(char const* msg) : _retval(0), _msg(msg) {}
ch_module_exc(int retval, char const* msg) : _retval(retval), _msg(std::string(msg) + boost::lexical_cast<std::string>(retval)) {}
int get_result() { return _retval; }
char const* get_message() { return _msg.c_str(); }
private:
int _retval;
std::string _msg;
};
#endif // ch_except_h__