Skip to content

Commit 5ee6cd4

Browse files
committed
moveonly: add mp/type-exception.h
1 parent 3946512 commit 5ee6cd4

File tree

3 files changed

+23
-9
lines changed

3 files changed

+23
-9
lines changed

CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ set(MP_PUBLIC_HEADERS
4747
include/mp/proxy.h
4848
include/mp/type-char.h
4949
include/mp/type-context.h
50+
include/mp/type-exception.h
5051
include/mp/type-function.h
5152
include/mp/type-interface.h
5253
include/mp/type-map.h

include/mp/proxy-types.h

-9
Original file line numberDiff line numberDiff line change
@@ -205,15 +205,6 @@ struct ListOutput<::capnp::List<T, kind>>
205205
// clang-format on
206206
};
207207

208-
template <typename Output>
209-
void CustomBuildField(TypeList<std::exception>,
210-
Priority<1>,
211-
InvokeContext& invoke_context,
212-
const std::exception& value,
213-
Output&& output)
214-
{
215-
BuildField(TypeList<std::string>(), invoke_context, output, std::string(value.what()));
216-
}
217208
template <typename LocalType, typename Value, typename Output>
218209
void CustomBuildField(TypeList<const LocalType>,
219210
Priority<0>,

include/mp/type-exception.h

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright (c) 2025 The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+
#ifndef MP_PROXY_TYPE_EXCEPTION_H
6+
#define MP_PROXY_TYPE_EXCEPTION_H
7+
8+
#include <mp/util.h>
9+
10+
namespace mp {
11+
template <typename Output>
12+
void CustomBuildField(TypeList<std::exception>,
13+
Priority<1>,
14+
InvokeContext& invoke_context,
15+
const std::exception& value,
16+
Output&& output)
17+
{
18+
BuildField(TypeList<std::string>(), invoke_context, output, std::string(value.what()));
19+
}
20+
} // namespace mp
21+
22+
#endif // MP_PROXY_TYPE_EXCEPTION_H

0 commit comments

Comments
 (0)