Skip to content

Commit efffd51

Browse files
committed
Add error::canceled.
1 parent 3432575 commit efffd51

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

include/bitcoin/database/error.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ enum error_t : uint8_t
3535
{
3636
/// general
3737
success,
38+
canceled,
3839
unknown_state,
40+
41+
/// integrity (internal fault)
3942
integrity,
4043
integrity1,
4144
integrity2,

src/error.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ DEFINE_ERROR_T_MESSAGE_MAP(error)
2828
{
2929
// general
3030
{ success, "success" },
31+
{ canceled, "canceled" },
3132
{ unknown_state, "unknown state" },
33+
34+
// integrity (internal fault)
3235
{ integrity, "store corrupted" },
3336
{ integrity1, "store corrupted1" },
3437
{ integrity2, "store corrupted2" },

test/error.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ BOOST_AUTO_TEST_CASE(error_t__code__success__false_exected_message)
3232
BOOST_REQUIRE_EQUAL(ec.message(), "success");
3333
}
3434

35+
BOOST_AUTO_TEST_CASE(error_t__code__canceled__true_exected_message)
36+
{
37+
constexpr auto value = error::canceled;
38+
const auto ec = code(value);
39+
BOOST_REQUIRE(ec);
40+
BOOST_REQUIRE(ec == value);
41+
BOOST_REQUIRE_EQUAL(ec.message(), "canceled");
42+
}
43+
3544
BOOST_AUTO_TEST_CASE(error_t__code__unknown_state__true_exected_message)
3645
{
3746
constexpr auto value = error::unknown_state;

0 commit comments

Comments
 (0)