diff options
author | Determinant <[email protected]> | 2019-06-14 17:08:33 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2019-06-14 17:08:33 -0400 |
commit | a9005311f51a250db26c966ce5fd4a7ba7d76fab (patch) | |
tree | 6a31f53fa4f6e4cd77ca0d403151c9c9645f3ed1 /src/network.cpp | |
parent | 6c927588f78c663fded354fd696997d09fb5d697 (diff) |
minor API change
Diffstat (limited to 'src/network.cpp')
-rw-r--r-- | src/network.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/network.cpp b/src/network.cpp index 91fc770..ef16bed 100644 --- a/src/network.cpp +++ b/src/network.cpp @@ -100,6 +100,22 @@ void msgnetwork_reg_conn_handler(msgnetwork_t *self, }); } +void msgnetwork_reg_error_handler(msgnetwork_t *self, + msgnetwork_error_callback_t cb, + void *userdata) { + self->reg_error_handler([=](const std::exception_ptr _err, bool fatal) { + SalticidaeCError cerror; + try { + std::rethrow_exception(_err); + } catch (SalticidaeError &err) { + cerror = err.get_cerr(); + } catch (...) { + cerror = salticidae_cerror_unknown(); + } + cb(&cerror, fatal, userdata); + }); +} + void msgnetwork_start(msgnetwork_t *self) { self->start(); } void msgnetwork_terminate(msgnetwork_t *self, const msgnetwork_conn_t *conn) { |