Jack2
1.9.8
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
common
JackException.h
1
/*
2
Copyright (C) 2008 Grame
3
4
This program is free software; you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation; either version 2 of the License, or
7
(at your option) any later version.
8
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
13
14
You should have received a copy of the GNU General Public License
15
along with this program; if not, write to the Free Software
16
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18
*/
19
20
#ifndef __JackException__
21
#define __JackException__
22
23
#include <stdexcept>
24
#include <iostream>
25
#include <string>
26
#include "JackError.h"
27
28
namespace
Jack
29
{
30
31
#define ThrowIf(inCondition, inException) \
32
if(inCondition) \
33
{ \
34
throw(inException); \
35
}
36
37
42
class
SERVER_EXPORT
JackException
:
public
std::runtime_error {
43
44
public
:
45
46
JackException
(
const
std::string& msg) : std::runtime_error(msg)
47
{}
48
JackException
(
char
* msg) : std::runtime_error(msg)
49
{}
50
JackException
(
const
char
* msg) : std::runtime_error(msg)
51
{}
52
53
std::string Message()
54
{
55
return
what();
56
}
57
58
void
PrintMessage()
59
{
60
std::string str = what();
61
if
(str !=
""
) {
62
jack_info
(str.c_str());
63
}
64
}
65
};
66
71
class
SERVER_EXPORT
JackTemporaryException
:
public
JackException
{
72
73
public
:
74
75
JackTemporaryException
(
const
std::string& msg) :
JackException
(msg)
76
{}
77
JackTemporaryException
(
char
* msg) :
JackException
(msg)
78
{}
79
JackTemporaryException
(
const
char
* msg) :
JackException
(msg)
80
{}
81
JackTemporaryException
() :
JackException
(
""
)
82
{}
83
};
84
89
class
SERVER_EXPORT
JackQuitException
:
public
JackException
{
90
91
public
:
92
93
JackQuitException
(
const
std::string& msg) :
JackException
(msg)
94
{}
95
JackQuitException
(
char
* msg) :
JackException
(msg)
96
{}
97
JackQuitException
(
const
char
* msg) :
JackException
(msg)
98
{}
99
JackQuitException
() :
JackException
(
""
)
100
{}
101
};
102
107
class
SERVER_EXPORT
JackNetException
:
public
JackException
{
108
109
public
:
110
111
JackNetException
(
const
std::string& msg) :
JackException
(msg)
112
{}
113
JackNetException
(
char
* msg) :
JackException
(msg)
114
{}
115
JackNetException
(
const
char
* msg) :
JackException
(msg)
116
{}
117
JackNetException
() :
JackException
(
""
)
118
{}
119
};
120
121
}
122
123
#endif
Generated by
1.8.2