Exceptions

Published on Saturday, December 30, 2023

Exceptions

When there's an exception in an async Task<T>, don�t return null, return a reasonable default; if a method would normally return a Task<List<SomeType>>, you can return new().

Please, please don�t do this:

catch (Exception)
{
  MessageService.ShowMessage("Something Went Wrong");
}

Only catch known exceptions; this is over-broad and just hides problems.