Skip to content

Commit 3c482c4

Browse files
authored
CBOR wrappers: proper error message order (#7572)
1 parent d93d7b4 commit 3c482c4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/crypto/cbor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ namespace ccf::cbor
8888
{
8989
if (!msg.empty())
9090
{
91-
throw CBORDecodeError(fmt::format("{}: {}", err.what(), msg));
91+
throw CBORDecodeError(fmt::format("{}: {}", msg, err.what()));
9292
}
9393
throw err;
9494
}

src/crypto/test/cbor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1454,7 +1454,7 @@ TEST_CASE("CBOR: throw with context")
14541454

14551455
const std::string context = "Custom enough context";
14561456
const std::string err = "Not a string value";
1457-
const std::string expected_err = err + ": " + context;
1457+
const std::string expected_err = context + ": " + err;
14581458
REQUIRE_THROWS_WITH_AS(
14591459
rethrow_with_msg([&]() { std::ignore = v->as_string(); }, context),
14601460
expected_err.c_str(),

0 commit comments

Comments
 (0)