- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
namespace {
class blah_error : public std::exception
public:
blah_error(const char *text)
: m_text(text)
{}
virtual const char *what() const throw()
{ return m_text; }
private:
const char *m_text;
};
}
BlahApplication::BlahApplication(const some_type &some_arg)
{
// ...
if (SomeCheck(some_arg)) {
throw blah_error("some error message");
}
// ...
}
bormand 03.08.2015 12:33 # 0
roman-kashitsyn 03.08.2015 12:42 # 0
Setry 03.08.2015 12:48 # 0
bormand 03.08.2015 12:57 # 0
Как std::exception &, тогда уж...
Setry 03.08.2015 13:02 # 0
roman-kashitsyn 03.08.2015 12:57 # 0
bormand 03.08.2015 12:59 # 0
Setry 03.08.2015 13:03 # 0
bormand 03.08.2015 13:09 # +1