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
50class shared_block : public std::runtime_error
51{
52public:
53 explicit shared_block(const std::string& error)
54 : runtime_error(error) { }
55};
56
59class database_corrupt : public std::runtime_error
60{
61public:
62 explicit database_corrupt(const std::string& error)
63 : runtime_error(error) { }
64};
65
69{
70public:
72 : database_corrupt("Unexpected Database Format") { }
73};
74
78{
79public:
80 explicit unexpected_page(const std::string& error)
82};
83
87{
88public:
89 explicit unexpected_block(const std::string& error)
91};
92
96{
97public:
98 crc_fail(const std::string& error, ulonglong location, block_id id, ulong actual, ulong expected)
99 : database_corrupt(error), m_location(location), m_id(id), m_actual(actual), m_expected(expected) { }
100private:
101 ulonglong m_location;
102 block_id m_id;
103 ulong m_actual;
104 ulong m_expected;
105};
106
110{
111public:
112 sig_mismatch(const std::string& error, ulonglong location, block_id id, ulong actual, ulong expected)
113 : database_corrupt(error), m_location(location), m_id(id), m_actual(actual), m_expected(expected) { }
114private:
115 ulonglong m_location;
116 block_id m_id;
117 ulong m_actual;
118 ulong m_expected;
119};
120
124template<typename K>
125class key_not_found : public std::exception
126{
127public:
128 explicit key_not_found(const K& k)
129 : m_k(k) { }
130 virtual ~key_not_found() throw() { }
131
132 const char* what() const throw()
133 { return "key not found"; }
134
137 const K& which() const
138 { return m_k; }
139private:
140 key_not_found<K>& operator=(const key_not_found<K>&);
141 const K m_k;
142};
143
144
145} // end namespace
146
147#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:96
crc_fail(const std::string &error, ulonglong location, block_id id, ulong actual, ulong expected)
Definition errors.h:98
The database is corrupt.
Definition errors.h:60
database_corrupt(const std::string &error)
Definition errors.h:62
The database was not in the expected format.
Definition errors.h:69
The requested key was not found.
Definition errors.h:126
key_not_found(const K &k)
Definition errors.h:128
const char * what() const
Definition errors.h:132
const K & which() const
Returns the key which was not found.
Definition errors.h:137
virtual ~key_not_found()
Definition errors.h:130
This function or method has not been implemented.
Definition errors.h:30
not_implemented(const std::string &error)
Definition errors.h:32
An edit was attempted on a block with more than one reference.
Definition errors.h:51
shared_block(const std::string &error)
Definition errors.h:53
An unexpected signature was encountered.
Definition errors.h:110
sig_mismatch(const std::string &error, ulonglong location, block_id id, ulong actual, ulong expected)
Definition errors.h:112
An unexpected block or block type was encountered.
Definition errors.h:87
unexpected_block(const std::string &error)
Definition errors.h:89
An unexpected page or page type was encountered.
Definition errors.h:78
unexpected_page(const std::string &error)
Definition errors.h:80
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.