-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathexception.cpp
33 lines (25 loc) · 1.05 KB
/
exception.cpp
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
/// exception.cpp -- exception impl
/// Author: Zhang Yichao <echaozh@gmail.com>
/// Created: 2011-08-03
///
#include "exception.hpp"
using namespace std;
string err_to_str (error e)
{
switch (e) {
case success: return "success";
case bad_proto: return "protocol error";
case bad_req: return "bad request";
case bad_txn: return "unknown transaction, perhaps it timed out earlier";
case bad_arg: return "bad argument for sql statement";
case bad_caller: return "transaction was initiated by another caller";
case db_dup: return "duplicate key when inserting";
case db_noref: return "foreign reference not found when inserting/updating";
case db_reffed: return "key is referenced, cannot delete";
case db_stmt: return "statement execution failed, you may retry";
case db_txn: return "statement execution failed, transaction is doomed";
case txn_timeout: return "transaction has timed out, do not continue";
case not_support: return "statement to execute is not supported";
default: return "unknown error";
}
}