Electroneum
Toggle main menu visibility
Loading...
Searching...
No Matches
error.h
Go to the documentation of this file.
1
// Copyright (c) 2014-2018, The Monero Project
2
// All rights reserved.
3
//
4
// Redistribution and use in source and binary forms, with or without modification, are
5
// permitted provided that the following conditions are met:
6
//
7
// 1. Redistributions of source code must retain the above copyright notice, this list of
8
// conditions and the following disclaimer.
9
//
10
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
11
// of conditions and the following disclaimer in the documentation and/or other
12
// materials provided with the distribution.
13
//
14
// 3. Neither the name of the copyright holder nor the names of its contributors may be
15
// used to endorse or promote products derived from this software without specific
16
// prior written permission.
17
//
18
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
19
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
21
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
25
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
26
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
#pragma once
28
29
#include <system_error>
30
#include <type_traits>
31
33
#define ELECTRONEUM_LMDB_CHECK(...) \
34
do \
35
{ \
36
const int err = __VA_ARGS__ ; \
37
if (err) \
38
return {lmdb::error(err)}; \
39
} while (0)
40
41
namespace
lmdb
42
{
44
enum class
error
:
int
45
{
46
// 0 is reserved for no error, as per expect<T>
47
// All other errors are the values reported by LMDB
48
};
49
50
std::error_category
const
&
error_category
() noexcept;
51
52
inline
std
::error_code
make_error_code
(
error
value
) noexcept
53
{
54
return
std::error_code{int(
value
),
error_category
()};
55
}
56
}
57
58
namespace
std
59
{
60
template
<>
61
struct
is_error_code_enum<::
lmdb::error
>
62
: true_type
63
{};
64
}
inline
#define inline
Definition
inline_c.h:35
lmdb
Definition
database.cpp:46
lmdb::error_category
std::error_category const & error_category() noexcept
Definition
error.cpp:92
lmdb::error
error
Tracks LMDB error codes.
Definition
error.h:45
lmdb::make_error_code
std::error_code make_error_code(error value) noexcept
Definition
error.h:52
std
STL namespace.
value
const GenericPointer< typename T::ValueType > T2 value
Definition
pointer.h:1225
src
lmdb
error.h
Generated on
for Electroneum by
1.17.0