Problem
I am developing web API Application in asp.net core with ef core and using repository pattern. all the API is consumes by mobile developer as well as web developer.
I need to make a generic Exception handling in a way that all error I catch on server side is send my custom error code like application codes, server codes, and database codes for error and send it to the consumer in such a way that it is easy to incorporate these code and error to display user friendly code to users.
and also in a case where undetermined error occur is code and it is also handle through that mechanism and suggestion or implementation or documentation available kindly share. I already go through the internet for this problem but can't find the best generic way to handle it.