Merhex
Service layer exception or bool/error object
In my experience it is better to return a response object containing information about the request from the service layer, not simply a boolean as it can be ambiguous to its meaning. Per example, say something happened during the request, you return a response object with an error message inside. How this response object looks like is up to you, but great places to start are discriminated unions, or a library like ErrorOr
4 replies