1 | /**********************************************************************
|
---|
2 | *
|
---|
3 | * IErrors.h
|
---|
4 | * Copyright (C) 2003 UNESCO
|
---|
5 | *
|
---|
6 | * A component of the Greenstone digital library software
|
---|
7 | * from the New Zealand Digital Library Project at the
|
---|
8 | * University of Waikato, New Zealand.
|
---|
9 | *
|
---|
10 | * This program is free software; you can redistribute it and/or modify
|
---|
11 | * it under the terms of the GNU General Public License as published by
|
---|
12 | * the Free Software Foundation; either version 2 of the License, or
|
---|
13 | * (at your option) any later version.
|
---|
14 | *
|
---|
15 | * This program is distributed in the hope that it will be useful,
|
---|
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
18 | * GNU General Public License for more details.
|
---|
19 | *
|
---|
20 | * You should have received a copy of the GNU General Public License
|
---|
21 | * along with this program; if not, write to the Free Software
|
---|
22 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
23 | *
|
---|
24 | *********************************************************************/
|
---|
25 |
|
---|
26 |
|
---|
27 | #ifndef __ISIS_ERROR_H__
|
---|
28 | #define __ISIS_ERROR_H__
|
---|
29 |
|
---|
30 | enum IsisError { // Database error codes
|
---|
31 | ISIS_NO_ERROR = 0, // No errors reported
|
---|
32 | ISIS_INVALID_CODE,
|
---|
33 | ISIS_BAD_ALLOC,
|
---|
34 | ISIS_XRF_OPEN_ERROR, // Xrf open error
|
---|
35 | ISIS_XRF_CREATE_ERROR, // Xrf creation error
|
---|
36 | ISIS_XRF_READ_ERROR, // Xrf read error
|
---|
37 | ISIS_XRF_WRITE_ERROR, // Xrf write error
|
---|
38 | ISIS_XRF_CORRUPT, // Xrf corrupted
|
---|
39 | ISIS_XRF_INVALID_BLOCK, // Xrf invalid block
|
---|
40 | ISIS_XRF_INVALID_STATUS, // Xrf invalid status
|
---|
41 | ISIS_MF_ALREADY_EXIST_ERROR, // Attempt to create an existing mf
|
---|
42 | ISIS_MF_OPEN_ERROR, // Mf open error
|
---|
43 | ISIS_MF_CREATE_ERROR, // Mf creation error
|
---|
44 | ISIS_MF_READ_ERROR, // Mf read error
|
---|
45 | ISIS_MF_WRITE_ERROR, // Mf write error
|
---|
46 | ISIS_ASSERT_ERROR, // Assertion failed
|
---|
47 | ISIS_BAD_CLASS_ID, // Wrong object type
|
---|
48 | ISIS_BAD_OBJECT_ADDRESS, // Bad object address ISIS_BAD_REFERENCE, // Bad Reference
|
---|
49 | ISIS_CACHE_FULL, // Cache full
|
---|
50 | ISIS_CHECKSUM_ERROR, // Checksum Error
|
---|
51 | ISIS_DIVIDEBY_ZERO, // Divide By Zero Error
|
---|
52 | ISIS_EOF_ERROR, // Unexpected end of file
|
---|
53 | ISIS_FILE_CLOSE_ERROR, // Error closing file
|
---|
54 | ISIS_FILE_CORRUPT, // File corrupted
|
---|
55 | ISIS_FILE_CREATION_ERROR, // Error creating file
|
---|
56 | ISIS_FILE_EXISTS, // File already exists
|
---|
57 | ISIS_FILE_NOT_OPEN_ERROR, // Trying to use a closed file
|
---|
58 | ISIS_FILE_NOT_READY, // File not ready (failed or closed file)
|
---|
59 | ISIS_FILE_NOT_WRITEABLE, // Could not write to file
|
---|
60 | ISIS_FILE_OPEN_ERROR, // Error opening file
|
---|
61 | ISIS_FILE_POSITION_ERROR, // Cannot obtain the current file position
|
---|
62 | ISIS_FILE_READ_ERROR, // Error reading file
|
---|
63 | ISIS_FILE_SEEK_ERROR, // Error seeking in file
|
---|
64 | ISIS_FILE_WRITE_ERROR, // Error writing to file
|
---|
65 | ISIS_NO_DATABASE_OPEN, // No database open
|
---|
66 | ISIS_NO_FILE_EXISTS, // No such file exists
|
---|
67 | ISIS_NO_OBJECTS_EXIST, // No objects exist
|
---|
68 | ISIS_NULL_PTR, // Accessing a null pointer
|
---|
69 | ISIS_OBJECT_EXISTS, // Object already exists
|
---|
70 | ISIS_OPEN_FILE_REFERENCE, // Another object is referencing this file
|
---|
71 | ISIS_OVERFLOW, // Math overflow
|
---|
72 | ISIS_PARSE_ERROR, // Parse error
|
---|
73 | ISIS_PATH_ERROR, // Invalid path
|
---|
74 | ISIS_READ_ONLY_FILE, // Trying to write to read-only file
|
---|
75 | ISIS_STACK_EMPTY, // Stack empty
|
---|
76 | ISIS_STACK_FULL, // Stack full
|
---|
77 | ISIS_SYNC_ERROR, // Synchronization Error
|
---|
78 | ISIS_UNDERFLOW, // Math under-flow
|
---|
79 | ISIS_WRONG_FILE_TYPE, // Wrong file type
|
---|
80 |
|
---|
81 | // Persistent lock error codes
|
---|
82 | ISIS_INVALID_LOCK_TYPE, // Invalid lock type specified
|
---|
83 | ISIS_MFLOCK_ACCESS_ERROR, // The file lock cannot be accessed
|
---|
84 | ISIS_MFLOCK_ERROR, // Error locking the file
|
---|
85 | ISIS_RECORDLOCK_ACCESS_ERROR, // The record lock cannot be accessed
|
---|
86 | ISIS_RECORDLOCK_ERROR // Error locking a record
|
---|
87 | };
|
---|
88 |
|
---|
89 | // Standalone functions use to report database errors
|
---|
90 | const char *isisExceptionMessage(IsisError err);
|
---|
91 |
|
---|
92 | #ifdef __CPP_EXCEPTIONS__
|
---|
93 | // Class declarations for exceptions representing program errors.
|
---|
94 | // This implementation is provided for use C++'s built-in exception
|
---|
95 | // handling routines.
|
---|
96 |
|
---|
97 | // A fatal file error condition has been reached. All database engine
|
---|
98 | // calls must catch this exception and evaluate it by testing the
|
---|
99 | // vbDatabase or vbDatabase64 internal error variable.
|
---|
100 | class CIsisException { };
|
---|
101 |
|
---|
102 | #endif // __CPP_EXCEPTIONS__
|
---|
103 |
|
---|
104 | #endif // __ISIS_ERROR_H__
|
---|