feat: add thespian_unexpected to C API

This commit is contained in:
CJ van den Berg 2026-03-04 21:42:30 +01:00
parent 5789db98fc
commit e9c1758101
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
3 changed files with 17 additions and 4 deletions

View file

@ -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)