35 #include <unordered_map>
45 ErrorInfo error_info[] = {
63 "HYPERTABLE block compressor unsupported type" },
65 "HYPERTABLE block compressor invalid arg" },
67 "HYPERTABLE block compressor block truncated" },
69 "HYPERTABLE block compressor bad block header" },
71 "HYPERTABLE block compressor bad magic string" },
73 "HYPERTABLE block compressor block checksum mismatch" },
75 "HYPERTABLE block compressor deflate error" },
77 "HYPERTABLE block compressor inflate error" },
79 "HYPERTABLE block compressor initialization error" },
84 "HYPERTABLE Hyperspace client connect error" },
172 "HYPERSPACE Berkeley DB deadlock" },
174 "HYPERSPACE Berkeley DB replication handle dead" },
178 "HYPERSPACE unable to create session " },
180 "HYPERSPACE not master location" },
183 "HYPERSPACE State DB error" },
185 "HYPERSPACE State DB deadlock" },
187 "HYPERSPACE State DB bad key" },
189 "HYPERSPACE State DB bad value" },
191 "HYPERSPACE State DB attempt to access/delete previously deleted state" },
193 "HYPERSPACE State DB event exists" },
195 "HYPERSPACE State DB event does not exist" },
197 "HYPERSPACE State DB event attr not found" },
199 "HYPERSPACE State DB session exists" },
201 "HYPERSPACE State DB session does not exist" },
203 "HYPERSPACE State DB session attr not found" },
205 "HYPERSPACE State DB handle exists" },
207 "HYPERSPACE State DB handle does not exist" },
209 "HYPERSPACE State DB handle attr not found" },
211 "HYPERSPACE State DB node exists" },
213 "HYPERSPACE State DB node does not exist" },
215 "HYPERSPACE State DB node attr not found" },
217 "HYPERSPACE client/server protocol version mismatch" },
225 "MASTER range server with same location already registered" },
228 "Master schema generation mismatch" },
230 "MASTER location already assigned" },
237 "RANGE SERVER generation mismatch" },
239 "RANGE SERVER range already loaded" },
242 "RANGE SERVER non-existent range" },
246 "RANGE SERVER invalid scanner id" },
248 "RANGE SERVER schema parse error" },
250 "RANGE SERVER invalid column family id" },
252 "RANGE SERVER invalid column family" },
254 "RANGE SERVER truncated commit log" },
256 "RANGE SERVER no metadata for range" },
259 "RANGE SERVER corrupt commit log" },
262 "RANGE SERVER supplied revision is not strictly increasing" },
266 "RANGE SERVER bad scan specification" },
268 "RANGE SERVER clock skew detected" },
270 "RANGE SERVER bad CellStore filename" },
272 "RANGE SERVER corrupt CellStore" },
280 "RANGE SERVER fragment already processed"},
282 "RANGE SERVER recovery plan generation mismatch"},
284 "RANGE SERVER phantom range map not found"},
286 "RANGE SERVER ranges already live"},
288 "RANGE SERVER range not yet acknowledged"},
290 "RANGE SERVER server in readonly mode"},
292 "RANGE SERVER range not yet relinquished"},
306 "SERIALIZATION input buffer overrun" },
317 typedef std::unordered_map<int, const char *> TextMap;
319 TextMap &build_text_map() {
320 TextMap *map =
new TextMap();
321 for (
int i=0; error_info[i].text != 0; i++)
322 (*map)[error_info[i].code] = error_info[i].text;
326 TextMap &text_map = build_text_map();
331 const char *text = text_map[error];
333 return "ERROR NOT REGISTERED";
338 out <<
"<table border=\"1\" cellpadding=\"4\" cellspacing=\"1\" style=\"width: 720px; \">\n";
339 out <<
"<thead><tr><th scope=\"col\">Code<br />(hexidecimal)</th>\n";
340 out <<
"<th scope=\"col\">Code<br />(decimal)</th>\n";
341 out <<
"<th scope=\"col\">Description</th></tr></thead><tbody>\n";
343 for (
size_t i=0; error_info[i].text; i++) {
344 if (error_info[i].code >= 0)
345 out <<
"<tr><td style=\"text-align: right; \"><code>0x" << std::hex << error_info[i].code <<
"</code></td>\n";
347 out <<
"<tr><td style=\"text-align: right; \"><code></code></td>\n";
348 out <<
"<td style=\"text-align: right; \"><code>" << std::dec << error_info[i].code <<
"</code></td>\n";
349 out <<
"<td>" << error_info[i].text <<
"</td></tr>\n";
351 out <<
"</tbody></table>\n" << std::flush;
358 const char *ptr = strstr(e.
file(),
"src/cc/");
359 return ptr ? ptr : e.
file();
365 out <<
"Hypertable::Exception: "<< e.
message() <<
" - "
369 out <<
"\n\tat "<< e.
func() <<
" (";
377 int prev_code = e.
code();
380 out <<
"\n\tat "<< (prev->func() ? prev->func() :
"-") <<
" (";
382 out << (prev->file() ? prev->file() :
"-") <<
':'<< prev->line();
385 out <<
"): " << prev->message();
387 if (prev->code() != prev_code) {
389 prev_code = prev->code();
400 out << sep << p->message();
const char * func() const
Returns the name of the function which threw the Exception.
virtual std::ostream & render_messages(std::ostream &out, const char *sep) const
Renders multiple Exceptions to an ostream.
void generate_html_error_code_documentation(std::ostream &out)
Generates and print the error documentation as html.
const char * get_text(int error)
Returns a descriptive error message.
ExceptionMessageRenderer message() const
Retrieves a Renderer for this Exception.
Logging routines and macros.
Compatibility Macros for C/C++.
int m_error
The error code.
std::ostream & operator<<(std::ostream &os, const crontab_entry &entry)
Helper function to write crontab_entry to an ostream.
const char * file() const
Returns the source code line number where the exception was thrown.
Exception * prev
The previous exception in the exception chain.
const char * relative_fname(const Exception &e)
LogWriter * get()
Accessor for the LogWriter singleton instance.
This is a generic exception class for Hypertable.
bool show_line_numbers() const
Returns true if line numbers are printed.
Error codes, Exception handling, error logging.
int line() const
Returns the source code line number where the exception was thrown.
int code() const
Returns the error code.