-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrm_error.cpp
More file actions
43 lines (39 loc) · 1.08 KB
/
Copy pathrm_error.cpp
File metadata and controls
43 lines (39 loc) · 1.08 KB
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
//
// rm_error.cpp
//
#include "rm_error.h"
#include "pf.h"
#include <iostream>
using namespace std;
const char * RMWarnMsg[] = {
"bad record size <= 0",
"This rid has no record",
};
const char *RMErrorMsg[] = {
"record size is too big for a page",
"error is in the PF component",
"record null",
"record size mismatch",
"attempt to open already open file handle",
"bad parameters specified to RM open/create file handle",
"file is not open",
"Bad RID - invalid page num or slot num",
"end of file",
};
void RMPrintError(RC rc)
{
if (rc >= START_RM_WARN && rc <= RM_LASTWARN)
cerr << "RM warning: " << RMWarnMsg[rc - START_RM_WARN] << endl;
else if ((-rc >= -START_RM_ERR) && (-rc <= -RM_LASTERROR))
cerr << "RM error: " << RMErrorMsg[-rc + START_RM_ERR] << endl;
else if (rc == 0)
cerr << "RMPrintError called with return code of 0." << endl;
else
{
// Êä³ö´íÎóÐÅÏ¢
cerr << "rc was" << rc << endl;
cerr << "START_RM_ERR was " << START_RM_ERR << endl;
cerr << "RM_LASTERROR was " << RM_LASTERROR << endl;
cerr << "RM error: " << rc << "is out of bounds" << endl;
}
}