-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexceptions.hh
More file actions
38 lines (29 loc) · 833 Bytes
/
exceptions.hh
File metadata and controls
38 lines (29 loc) · 833 Bytes
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
#ifndef _GLFT_EXCEPTIONS_HH_
#define _GLFT_EXCEPTIONS_HH_
#include <exception>
#include <string>
namespace glft {
/**
* @brief thrown when a file is not found
* @author amro
*/
class FileNotFound : public std::exception {
std::string data;
public:
FileNotFound(const std::string& filename) : data("File not found: " + filename) { };
virtual ~FileNotFound() throw() { };
inline virtual const char* what() const throw() {return data.c_str();};
};
/**
* @brief thrown by a function receiving an invalid argument
* @author amro
*/
class InvalidArgument : public std::exception {
std::string data;
public:
InvalidArgument(std::string filename) : data("Invalid argument: " + filename) { };
virtual ~InvalidArgument() throw() { };
inline virtual const char* what() const throw() {return data.c_str();};
};
}
#endif