-
Notifications
You must be signed in to change notification settings - Fork 1
/
error.cpp
38 lines (35 loc) · 923 Bytes
/
error.cpp
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 error_cpp
#define error_cpp
/*Including standard cpp h eaders*/
#include<string>
using namespace std;
class Error
{
private:
string message;
public:
Error(string message)
{
this->message = message;
}
string getMessage() const {return this->message;}
};
/*Checks if record is present or not*/
class NoSuchRecordError : public Error
{
public:
NoSuchRecordError() : Error("No Such record Found") {};
};
/*checks if files exist or not or any kind of I/O error*/
class IOError : public Error
{
public:
IOError() : Error("I/O Error => could not open or process the file , make sure 'vehicle.txt' , 'trips.txt' and 'user.txt' files exist in the directory") {};
};
/*Checks wether system is out of memory*/
class MemoryError: public Error
{
public:
MemoryError() : Error("System Out of Memory") {};
};
#endif