If an error/exception occurs in a repository class, should that exception get
a. caught & logged, or
b. thrown to the caller (a service — what should happen with it there?)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you can, handle the exception gracefully (catch, log, recover) in the repository and pass a failure condition back to your caller to allow the caller to handle the failure from their respect. If you can’t then it’s probably a fatal exception and time to log if you can and terminate.