react-native-windows icon indicating copy to clipboard operation
react-native-windows copied to clipboard

WinRTWebSocketResource throws on Windows API errors

Open JunielKatarn opened this issue 6 years ago • 4 comments

Exceptions are thrown, which always show in the debugger even if they are ultimately caught and managed.

Leverage the DEFAULT_CPPWINRT_EXCEPTIONS to make the Windows-provided WinRT APIs return a winrt::hresult value instead of throwing.

JunielKatarn avatar May 22 '20 21:05 JunielKatarn

this might be a little too big of a change; e.g. we already have code that does try/catch, so we'd have to propagate the change to make the return value of everything hresult to pretty much everything.

Instead we could file a feature request on the WinRTWebSocketResource API in ADO, to be quieter?

asklar avatar May 23 '20 22:05 asklar

@asklar It's not a big change. The exceptions are already caught within the interface IWebSocketResource boundary. The issue is, they still show up in a debuggint sessions before being handled by the catch block.

@acoates-ms suggests to use a different approach and have those Windows APIs return an hresult instead.

For future reference, the only error propagation mechanism of IWebSocketResource is whichever handler you define in SetOnError.

Also, we want to make this interfaces' methods noexcept, but we ran into issues when the implementing class was based on boost. I'll revisit this topic soon.

JunielKatarn avatar May 26 '20 20:05 JunielKatarn

@acoates-ms says that UWP implementation is already doing this, so the Desktop implementation should match.

chrisglein avatar May 28 '20 18:05 chrisglein

This was already approved for 62 and I'm approving for 63 as well

Khalef1 avatar Oct 29 '20 23:10 Khalef1