This should be a very simple question, but I can't seem to find an answer.
I'm using a standard dependency injection to inject a custom service into a controller in NET Core Web API.
private readonly IMyService _myService;
public MyController(IMyService MyService)
{
_myService= MyService;
}
IMyService contains all the methods with logic and MyService implements it. Now, is it possible to expose custom exception types to the controller via interface, so I'd be able throw those exceptions from MyService and catch them in MyController? As far as I understand C# - interfaces can't have custom classes as properties. Or is this approach wrong entirely? How else should I correctly communicate errors of different kinds from service back to controller?