moolicc / Wallop

Extensible, living/animated wallpaper engine built in C# using Silk.NET's OpenGL wrapper at its core.
29 stars 4 forks source link

Implement custom exception throwing/handling mechanism #151

Closed moolicc closed 1 year ago

moolicc commented 1 year ago

We need a way to perform exception handling/logging/reporting in a centralized place.

Once implemented, API-level functions should throw exceptions and user-facing business logic functions should call into our custom handler.

One design consideration:

SafetyNet.Handle<CallingClass>(_ => ThisMethodThrows());

The inner lambda could be a function, and the return value could be pushed to an out parameter maybe?

OR we can keep using the same old/ugly try/catches everywhere and call into a special function to handle those from there.