Cysharp / MagicOnion

Unified Realtime/API framework for .NET platform and Unity.
MIT License
3.9k stars 433 forks source link

How to catch uncaught exceptions thrown on the client by StreamingHub receiver methods? #832

Closed tyler-s-hatch closed 2 months ago

tyler-s-hatch commented 2 months ago

Wonderful library, really enjoying using it!

Is there way to register a callback that gets called when an uncaught exception is thrown from a StreamingHub receiver method on the client? I.e. when the server calls a receiver method and the receiving client throws an exception while handling the call. This is a Unity client.

I can wrap the logic inside of each receiver method with a try/catch, but I neglected to do that with a method, and lost some time today trying figure out why something broke, because my logging system didn't log the exception that was thrown. I'd like to ensure this does not happen in the future, even if I neglect to add a try/catch again, but I couldn't find a way to do that.

tyler-s-hatch commented 2 months ago

Disregard, I misunderstood what was happening.