FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
sqlite_orm/dev/error_code.h at master · air2/sqlite_orm · GitHub
air2
/
sqlite_orm
Public
forked from
fnc12/sqlite_orm
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
sqlite_orm
/
dev
/
error_code.h
Copy path
More file actions
More file actions
Latest commit
History
History
History
91 lines (76 loc) · 2.98 KB
Breadcrumbs
sqlite_orm
/
dev
/
error_code.h
Copy path
File metadata and controls
91 lines (76 loc) · 2.98 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#
pragma
once
#
include
<
system_error
>
//
std::error_code, std::system_error
#
include
<
string
>
//
std::string
#
include
<
sqlite3.h
>
#
include
<
stdexcept
>
namespace
sqlite_orm
{
enum
class
orm_error_code
{
not_found =
1
,
type_is_not_mapped_to_storage,
trying_to_dereference_null_iterator,
too_many_tables_specified,
incorrect_set_fields_specified,
column_not_found,
table_has_no_primary_key_column,
cannot_start_a_transaction_within_a_transaction,
no_active_transaction,
incorrect_journal_mode_string,
};
}
namespace
sqlite_orm
{
class
orm_error_category
:
public
std
::error_category {
public:
const
char
*
name
()
const
noexcept
override
final
{
return
"
ORM error
"
;
}
std::string
message
(
int
c)
const
override
final
{
switch
(
static_cast
<orm_error_code>(c)) {
case
orm_error_code::not_found:
return
"
Not found
"
;
case
orm_error_code::type_is_not_mapped_to_storage:
return
"
Type is not mapped to storage
"
;
case
orm_error_code::trying_to_dereference_null_iterator:
return
"
Trying to dereference null iterator
"
;
case
orm_error_code::too_many_tables_specified:
return
"
Too many tables specified
"
;
case
orm_error_code::incorrect_set_fields_specified:
return
"
Incorrect set fields specified
"
;
case
orm_error_code::column_not_found:
return
"
Column not found
"
;
case
orm_error_code::table_has_no_primary_key_column:
return
"
Table has no primary key column
"
;
case
orm_error_code::cannot_start_a_transaction_within_a_transaction:
return
"
Cannot start a transaction within a transaction
"
;
case
orm_error_code::no_active_transaction:
return
"
No active transaction
"
;
default
:
return
"
unknown error
"
;
}
}
};
class
sqlite_error_category
:
public
std
::error_category {
public:
const
char
*
name
()
const
noexcept
override
final
{
return
"
SQLite error
"
;
}
std::string
message
(
int
c)
const
override
final
{
return
sqlite3_errstr
(c);
}
};
inline
const
orm_error_category&
get_orm_error_category
() {
static
orm_error_category res;
return
res;
}
inline
const
sqlite_error_category&
get_sqlite_error_category
() {
static
sqlite_error_category res;
return
res;
}
}
namespace
std
{
template
<>
struct
is_error_code_enum
<sqlite_orm::orm_error_code> : std::true_type{};
inline
std::error_code
make_error_code
(sqlite_orm::orm_error_code errorCode) {
return
std::error_code
(
static_cast
<
int
>(errorCode),
sqlite_orm::get_orm_error_category
());
}
}
Back
|
FazBrowse Home
|
New Git URL