aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2019-06-14 17:08:33 -0400
committerDeterminant <[email protected]>2019-06-14 17:08:33 -0400
commita9005311f51a250db26c966ce5fd4a7ba7d76fab (patch)
tree6a31f53fa4f6e4cd77ca0d403151c9c9645f3ed1 /src
parent6c927588f78c663fded354fd696997d09fb5d697 (diff)
minor API change
Diffstat (limited to 'src')
-rw-r--r--src/network.cpp16
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) {