C#C
C#3y ago
Thalnos

❔ Exception hadnling in WPF App

I have an app that is being used as a TicketSystem. It monitors incoming calls and tickets for our Agents and lets the agents interact with those.
The calls are being queried from DB using Ado.Net Types (SqlConnection, SqlCommand)
The tickets are being queried from external api using HttpClient

Currently When there is an exception trying to get the calls or trying to get the tickets I display "Error, data couldn't be loaded" where I would otherwise display the respective DataGrid
using a regular catch(Exception ex){} block

One common scenario that made our App crash before we had this catch block was when the Agent is in his home office and doesn't have his VPN turned on to access company ressources.
Now I wonder whether I can catch a more specific exception, so that I can render "Make sure your VPN is turned on to access the company ressources" or smth like that.
Was this page helpful?