Exception handling and error response to an api

I am working to design the exception handling and error responses to an api. Can anyone let me know how the exceptions designed for enterprise applications. Can we map java pre defined exceptions to application exceptions. If so, how we have to map the pre defined java exceptions to our application scenario ? if not, how we need to designed the exceptions for enterprise applications ? any guidelines ? Once the exceptions are mapped it has been to given to service layer. Should error messages(for api response) framed in the service layer ? if yes, can you specify any reason ? if not can you specify any other options for framing error response of any api ? Can suggest any design technique followed in your application ? Thanks in advance

Comments (1)