C#C
C#3y ago
GameShark

❔ Catching Exceptions with generic parameters?

When adding an entity to the database, i first check if it already exists and if it does I throw an error. Now since I have alot of entities I was thinking of make an exception class that takes in a generic (the class type).

Unfortunately this doesn't work because I won't be able to catch it in my controller since I don't specify the generic.
image.png
Was this page helpful?