Skip to content

Commit b499cea

Browse files
committed
Collapsed multiple catch statements + now using error categories
1 parent 061499b commit b499cea

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

Release/src/websockets/client/ws_client.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class ws_desktop_client : public _websocket_client_impl, public std::enable_shar
171171
m_client.close(m_con, static_cast<websocketpp::close::status::value>(status), utility::conversions::to_utf8string(reason), ec);
172172
if (ec.value() != 0)
173173
{
174-
websocket_exception wx(ec.value());
174+
websocket_exception wx(ec.value(), ec.category());
175175
return pplx::task_from_exception<void>(wx);
176176
}
177177
}
@@ -274,7 +274,7 @@ class ws_desktop_client : public _websocket_client_impl, public std::enable_shar
274274
m_con = con;
275275
if (ec.value() != 0)
276276
{
277-
websocket_exception wx(ec.value());
277+
websocket_exception wx(ec.value(), ec.category());
278278
return pplx::task_from_exception<void>(wx);
279279
}
280280

@@ -441,14 +441,10 @@ class ws_desktop_client : public _websocket_client_impl, public std::enable_shar
441441
auto ec = previousTask.get();
442442
if (ec.value() != 0)
443443
{
444-
websocket_exception wx(ec.value());
444+
websocket_exception wx(ec.value(), ec.category());
445445
eptr = std::make_exception_ptr(wx);
446446
}
447447
}
448-
catch (const websocket_exception& ex)
449-
{
450-
eptr = std::make_exception_ptr(ex);
451-
}
452448
catch (...)
453449
{
454450
eptr = std::current_exception();
@@ -522,7 +518,6 @@ class ws_desktop_client : public _websocket_client_impl, public std::enable_shar
522518
// Queue to maintain the receive tasks when there are no messages(yet).
523519
std::queue<pplx::task_completion_event<websocket_incoming_message>> m_receive_task_queue;
524520

525-
526521
// Guards access to m_outgoing_msg_queue
527522
std::mutex m_send_lock;
528523

0 commit comments

Comments
 (0)