feat: add thespian_unexpected to C API
This commit is contained in:
parent
5789db98fc
commit
e9c1758101
3 changed files with 17 additions and 4 deletions
|
|
@ -47,6 +47,18 @@ auto thespian_exit(const char *status) -> thespian_result {
|
|||
return &exit_error_buf;
|
||||
}
|
||||
|
||||
auto thespian_unexpected(cbor_buffer m) -> thespian_result {
|
||||
cbor::buffer buf;
|
||||
const uint8_t *data = m.base;
|
||||
std::copy(data, data + m.len, back_inserter(buf)); // NOLINT
|
||||
auto r = thespian::unexpected(buf);
|
||||
if (r)
|
||||
return nullptr;
|
||||
exit_msg_buf = r.error();
|
||||
exit_error_buf = {exit_msg_buf.data(), exit_msg_buf.size()};
|
||||
return &exit_error_buf;
|
||||
}
|
||||
|
||||
void thespian_link(thespian_handle h) {
|
||||
thespian::handle *h_{
|
||||
reinterpret_cast<thespian::handle *>( // NOLINT(*-reinterpret-cast)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue