C
C#2y 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.
4 Replies
GameShark
GameSharkOP2y ago
GameShark
GameSharkOP2y ago
I guess i could do this, but it feels weird doing reflection for the arguments from wherever the exception gets thrown
GameShark
GameSharkOP2y ago
Thanks!
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity. Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server