PST File Format SDK v0.4
Loading...
Searching...
No Matches
errors.h
Go to the documentation of this file.
1
5
8
9#ifndef PSTSDK_UTIL_ERRORS_H
10#define PSTSDK_UTIL_ERRORS_H
11
12#include <stdexcept>
14
15namespace pstsdk
16{
17
20class can_not_resize : public std::runtime_error
21{
22public:
23 explicit can_not_resize(const std::string& error)
24 : runtime_error(error) { }
25};
26
29class not_implemented : public std::logic_error
30{
31public:
32 explicit not_implemented(const std::string& error)
33 : logic_error(error) { }
34};
35
38class write_error : public std::runtime_error
39{
40public:
41 explicit write_error(const std::string& error)
42 : runtime_error(error) { }
43};
44
47class database_corrupt : public std::runtime_error
48{
49public:
50 explicit database_corrupt(const std::string& error)
51 : runtime_error(error) { }
52};
53
57{
58public:
60 : database_corrupt("Unexpected Database Format") { }
61};
62
66{
67public:
68 explicit unexpected_page(const std::string& error)
70};
71
75{
76public:
77 explicit unexpected_block(const std::string& error)
79};
80
84{
85public:
86 crc_fail(const std::string& error, ulonglong location, block_id id, ulong actual, ulong expected)
87 : database_corrupt(error), m_location(location), m_id(id), m_actual(actual), m_expected(expected) { }
88private:
89 ulonglong m_location;
90 block_id m_id;
91 ulong m_actual;
92 ulong m_expected;
93};
94
98{
99public:
100 sig_mismatch(const std::string& error, ulonglong location, block_id id, ulong actual, ulong expected)
101 : database_corrupt(error), m_location(location), m_id(id), m_actual(actual), m_expected(expected) { }
102private:
103 ulonglong m_location;
104 block_id m_id;
105 ulong m_actual;
106 ulong m_expected;
107};
108
112template<typename K>
113class key_not_found : public std::exception
114{
115public:
116 explicit key_not_found(const K& k)
117 : m_k(k) { }
118 virtual ~key_not_found() throw() { }
119
120 const char* what() const throw()
121 { return "key not found"; }
122
125 const K& which() const
126 { return m_k; }
127private:
128 key_not_found<K>& operator=(const key_not_found<K>&);
129 const K m_k;
130};
131
132
133} // end namespace
134
135#endif
Contains references to other bth_node allocations.
Definition heap.h:364
A block or node can not satisfy a resize request.
Definition errors.h:21
can_not_resize(const std::string &error)
Definition errors.h:23
A CRC of an item failed.
Definition errors.h:84
crc_fail(const std::string &error, ulonglong location, block_id id, ulong actual, ulong expected)
Definition errors.h:86
The database is corrupt.
Definition errors.h:48
database_corrupt(const std::string &error)
Definition errors.h:50
The database was not in the expected format.
Definition errors.h:57
The requested key was not found.
Definition errors.h:114
key_not_found(const K &k)
Definition errors.h:116
const char * what() const
Definition errors.h:120
const K & which() const
Returns the key which was not found.
Definition errors.h:125
virtual ~key_not_found()
Definition errors.h:118
This function or method has not been implemented.
Definition errors.h:30
not_implemented(const std::string &error)
Definition errors.h:32
An unexpected signature was encountered.
Definition errors.h:98
sig_mismatch(const std::string &error, ulonglong location, block_id id, ulong actual, ulong expected)
Definition errors.h:100
An unexpected block or block type was encountered.
Definition errors.h:75
unexpected_block(const std::string &error)
Definition errors.h:77
An unexpected page or page type was encountered.
Definition errors.h:66
unexpected_page(const std::string &error)
Definition errors.h:68
An error occured writing to the file.
Definition errors.h:39
write_error(const std::string &error)
Definition errors.h:41
boost::uint64_t ulonglong
Definition primitives.h:70
boost::uint32_t ulong
Definition primitives.h:68
ulonglong block_id
Definition primitives.h:87
Contains the definition of all in memory representations of disk structures.
Definition disk.h:19
Primitive structures defined by MS-PST and MAPI.