-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathException.cc
More file actions
51 lines (41 loc) · 890 Bytes
/
Exception.cc
File metadata and controls
51 lines (41 loc) · 890 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
39
40
41
42
43
44
45
46
47
48
49
50
51
#include "Exception.h"
Exception::Exception(int errCode)
{
errorCode = errCode;
}
int Exception::getErrno()
{
return errorCode;
}
const char *Exception::getMessage()
{
const char *msg = "";
switch (errorCode)
{
case MALLOC_FAILED:
msg = "Failed to allocate buffer\n";
break;
case FILE_OPEN_FAILED:
msg = "Failed to open the file\n";
break;
case INVALID_FILE:
msg = "File handle invalid\n";
break;
case READ_FAILED:
msg = "Failed to read file\n";
break;
case WRITE_FAILED:
msg = "Failed to write to file\n";
break;
case ENC_ERROR:
msg = "Failed to Encrypt block\n";
break;
case DEC_ERROR:
msg = "Failed to Decrypt block\n";
break;
default:
msg = "Unexpected failure\n";
break;
}
return msg;
}