Skip to content

Commit c489b06

Browse files
committed
Adding try catch to make exceptions from winrt websocket client be of type websocket_exception.
1 parent 43ec46e commit c489b06

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Release/src/websockets/client/ws_client_winrt.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,14 @@ class winrt_callback_client : public websocket_client_callback_impl, public std:
184184
{
185185
// result.get() should happen before anything else, to make sure there is no unobserved exception
186186
// in the task chain.
187-
result.get();
187+
try
188+
{
189+
result.get();
190+
}
191+
catch (Platform::Exception ^e)
192+
{
193+
throw websocket_exception(e->HResult, build_error_msg(e, "ConnectAsync"));
194+
}
188195

189196
if (auto pThis = thisWeakPtr.lock())
190197
{

0 commit comments

Comments
 (0)