diff options
author | Sadie Powell <sadie@witchery.services> | 2024-03-11 13:53:05 +0000 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2024-03-11 19:17:29 +0000 |
commit | 29e7674e56bf2b829bba22def2760d034a76e788 (patch) | |
tree | f40049ba995b03dd7c510d88f9f19db2d2e65a2e /src/socketengines/poll.cpp | |
parent | e2df7d4d01f8fdb41c49ce8efc462cab005e7d5c (diff) |
Replace convertTo/stringify with non-throwing alternatives.
Having these throw is terrible for ergonomics and there are loads
of places where the exception was either silently ignored or not
handled at all. Having a function which returns an optional and
another that returns a default works a lot better imo.
Diffstat (limited to 'src/socketengines/poll.cpp')
-rw-r--r-- | src/socketengines/poll.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/socketengines/poll.cpp b/src/socketengines/poll.cpp index e9a81933b..feeac5967 100644 --- a/src/socketengines/poll.cpp +++ b/src/socketengines/poll.cpp @@ -71,7 +71,7 @@ void SocketEngine::Change(Socket *s, bool set, SocketFlag flag) { std::map<int, unsigned>::iterator pos = socket_positions.find(s->GetFD()); if (pos == socket_positions.end()) - throw SocketException("Unable to remove fd " + stringify(s->GetFD()) + " from poll, it does not exist?"); + throw SocketException("Unable to remove fd " + Anope::ToString(s->GetFD()) + " from poll, it does not exist?"); if (pos->second != events.size() - 1) { @@ -90,7 +90,7 @@ void SocketEngine::Change(Socket *s, bool set, SocketFlag flag) { std::map<int, unsigned>::iterator pos = socket_positions.find(s->GetFD()); if (pos == socket_positions.end()) - throw SocketException("Unable to modify fd " + stringify(s->GetFD()) + " in poll, it does not exist?"); + throw SocketException("Unable to modify fd " + Anope::ToString(s->GetFD()) + " in poll, it does not exist?"); pollfd &ev = events[pos->second]; ev.events = (s->flags[SF_READABLE] ? POLLIN : 0) | (s->flags[SF_WRITABLE] ? POLLOUT : 0); |