-
Notifications
You must be signed in to change notification settings - Fork 0
/
Exceptions.h
45 lines (39 loc) · 1.06 KB
/
Exceptions.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
45
/**
* Exceptions.h
*
* Created on: Aug 5, 2011
* Author: Jeroen Vlek
* Email: [email protected]
* Website: www.perceptivebits.com
* License: Free Beer (Feel free to use it in every
* way possible and if you like it, make
* sure to give me credit and buy me a drink
* if we ever meet ;) )
*/
#ifndef EXCEPTIONS_H_
#define EXCEPTIONS_H_
#include <exception>
#include <sstream>
class EvoPicException: public std::exception
{
public:
EvoPicException(const char* filename = NULL, const unsigned int line = 0)
: _filename(filename), _line(line) { }
protected:
const char* _filename;
const unsigned int _line;
};
class TargetImageNotLoadedEx: public EvoPicException
{
public:
TargetImageNotLoadedEx(const char* filename = NULL, const unsigned int line = 0)
: EvoPicException(filename, line) { }
virtual const char* what() const throw()
{
std::stringstream msg;
msg << "Exception: TargetImage not loaded at " <<
_filename << ", line " << _line;
return msg.str().c_str();
}
};
#endif /* EXCEPTIONS_H_ */