Skip to content

Commit 5346c4d

Browse files
committed
Update to latest with more no exceptions
1 parent 987364a commit 5346c4d

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

zmq.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ class message_t
556556
THROW_ERROR_T;
557557
memcpy(data(), data_, size_);
558558
}
559-
559+
560560
void rebuild(const std::string &str)
561561
{
562562
rebuild(str.data(), str.size());
@@ -2731,7 +2731,7 @@ template<typename T = no_user_data> class poller_t
27312731
void remove(fd_t fd)
27322732
{
27332733
if (0 != zmq_poller_remove_fd(poller_ptr.get(), fd)) {
2734-
throw error_t();
2734+
THROW_ERROR_T;
27352735
}
27362736
}
27372737

@@ -2749,7 +2749,7 @@ template<typename T = no_user_data> class poller_t
27492749
if (0
27502750
!= zmq_poller_modify_fd(poller_ptr.get(), fd,
27512751
static_cast<short>(events))) {
2752-
throw error_t();
2752+
THROW_ERROR_T;
27532753
}
27542754
}
27552755

@@ -2809,7 +2809,7 @@ template<typename T = no_user_data> class poller_t
28092809
if (0
28102810
!= zmq_poller_add_fd(poller_ptr.get(), fd, user_data,
28112811
static_cast<short>(events))) {
2812-
throw error_t();
2812+
THROW_ERROR_T;
28132813
}
28142814
}
28152815
};

zmq_addon.hpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -810,11 +810,20 @@ class active_poller_t
810810
const poller_ref_t ref{fd};
811811

812812
if (!handler)
813+
#ifndef CPPZMQ_NO_CPP_EXCEPTIONS
813814
throw std::invalid_argument("null handler in active_poller_t::add (fd)");
815+
#else
816+
std::abort();
817+
#endif
814818
auto ret = handlers.emplace(
815819
ref, std::make_shared<handler_type>(std::move(handler)));
816820
if (!ret.second)
821+
#ifndef CPPZMQ_NO_CPP_EXCEPTIONS
817822
throw error_t(EINVAL); // already added
823+
#else
824+
std::abort();
825+
#endif
826+
#ifndef CPPZMQ_NO_CPP_EXCEPTIONS
818827
try {
819828
base_poller.add(fd, events, ret.first->second.get());
820829
need_rebuild = true;
@@ -824,7 +833,10 @@ class active_poller_t
824833
handlers.erase(ref);
825834
throw;
826835
}
827-
836+
#else
837+
base_poller.add(fd, events, ret.first->second.get());
838+
need_rebuild = true;
839+
#endif
828840
}
829841

830842
void remove(zmq::socket_ref socket)

0 commit comments

Comments
 (0)