summaryrefslogtreecommitdiff
path: root/src/main/exceptions.cc
blob: 448951924a6fa139e133f9bdf3e23c16fc5bb4a9 (plain) (blame)
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
46
47
48
49
50
51
52
53
54
55
56
57
/*
 * exceptions.cc
 *
 *  Created on: Apr 17, 2011
 *      Author: jakob
 */

#include <sstream>
#include "exceptions.h"

namespace vhc {

Exception::Exception(): message("") {};

Exception::Exception(std::string message): message(message) {};

Exception::~Exception() {};

std::string Exception::getExceptionType() const {return "Exception";}

std::string Exception::getMessage() const {return message;}

std::string Exception::toString() const {
	std::stringstream s;
	s << getExceptionType() << ": " << getMessage();
	return s.str();
}


IllegalArgumentException::IllegalArgumentException(): Exception() {};
IllegalArgumentException::IllegalArgumentException(std::string message): Exception(message) {};

std::string IllegalArgumentException::getExceptionType() const {return "IllegalArgumentException";}



UnsupportedOperationException::UnsupportedOperationException(): Exception() {};
UnsupportedOperationException::UnsupportedOperationException(std::string message): Exception(message) {};

std::string UnsupportedOperationException::getExceptionType() const {return "UnsupportedOperationException";}



IOException::IOException(): Exception() {};
IOException::IOException(std::string message): Exception(message) {};

std::string IOException::getExceptionType() const {return "IOException";}

ReadException::ReadException(): Exception() {};
ReadException::ReadException(std::string message): Exception(message) {};

std::string ReadException::getExceptionType() const {return "ReadException";}

void ReadException::addReadExceptionMessage(std::string mess) {message += (" "+mess);}

}