title: Error Handling Should I throw exception? Or handle at the source?
body: <p>I have this sort of format</p>
  
  <p>asp.net MVC View -> Service Layer -> Repository.</p>
  
  <p>So the view calls the service layer which has business/validation logic in it which in turns calls the Repository.</p>
  
  <p>Now my service layer method usually has a bool return type so that I can return true if the database query has gone through good. Or if it failed. Then a generic message is shown to the user.</p>
  
  <p>I of course will log the error with elmah. However I am not sure how I should get to this point. </p>
  
  <p>Like right now my Repository has void return types for update,create,delete.</p>
  
  <p>So say if an update fails should I have a try/catch in my repository that throws the error,  Then my service layer catches it and does elmah signaling and returns false?</p>
  
  <p>Or should I have these repository methods return a "bool", try/catch the error in the repository and then return "true" or "false" to the service layer what in turn returns "true" or "false" to the view?</p>
  
  <p>Exception handling still confuses me how handle the errors and when to throw and when to catch the error.</p>