-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherror.h
77 lines (46 loc) · 1.55 KB
/
error.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef ERROR_H
#define ERROR_H
// error/status codes defined here
// add error codes under appropriate heading
// -- remember to add corresponding message to
// Error.print() also!
enum Status {
// no error
OK = 0, NOTUSED1 = -999,
// File and DB errors
BADFILEPTR, BADFILE, FILETABFULL, FILEOPEN, FILENOTOPEN,
UNIXERR, BADPAGEPTR, BADPAGENO, FILEEXISTS,
// BufMgr and HashTable errors
HASHTBLERROR, HASHNOTFOUND, BUFFEREXCEEDED, PAGENOTPINNED,
BADBUFFER, PAGEPINNED,
// Page errors
NOSPACE, NORECORDS, ENDOFPAGE, INVALIDSLOTNO, INVALIDRECLEN,
// HeapFile errors
BADRID, BADRECPTR, BADSCANPARM, BADSCANID, SCANTABFULL, FILEEOF, FILEHDRFULL,
// Index errors
BADINDEXPARM, RECNOTFOUND, BUCKETFULL, DIROVERFLOW,
NONUNIQUEENTRY, NOMORERECS,
// SortedFile errors
BADSORTPARM, INSUFMEM,
// Catalog errors
BADCATPARM, RELNOTFOUND, ATTRNOTFOUND,
NAMETOOLONG, DUPLATTR, RELEXISTS, NOINDEX,
INDEXEXISTS, ATTRTOOLONG,
// Utility errors
// Query errors
ATTRTYPEMISMATCH, TMP_RES_EXISTS,
// do not touch filler -- add codes before it
NOTUSED2
};
// definition of Error class
class Error {
public:
void print(Status status);
};
#define ASSERT(c) { if (!(c)) { \
cerr << "At line " << __LINE__ << ":" << endl << " "; \
cerr << "This condition should hold: " #c << endl; \
exit(1); \
} \
}
#endif