title: Is it better to catch exceptions or avoid exceptions at any cost?
body: <p>What's the best practice when you're dealing with exceptions? </p>
  
  <p>I usually write code to avoid exceptions at any cost, my code usually has a lot of conditions and if I'm dealing with normalized databases, I usually write a bunch of queries that double check if the values are already there. </p>
  
  <p>However, I've seen code that just listens for exceptions, and if an exception occurs then it is handled appropriately. </p>
  
  <p>What are the best practices in this scenario? </p>
  
  <p>Is it better to avoid errors and handle them before they happen, or just catch the exception and channel it to the right place? </p>
  
  <p>In terms of performance, I've seen that it's faster to catch the exceptions; especially if there's a database involved.</p>
  
  <p>However, I feel that some exceptions are too general for specific scenarios and it's hard to determine why that exception occured unless you see the stack trace. </p>
  
  <p>That said, unless you have a error reporting tool in place (rollbar, new relic, etc..) is especially hard to find the stack trace in the logs if you have customer facing interfaces and you receive tickets that only contain the words "500 error in X page".</p>
  
  <p>If this question is too broad for stackoverflow feel free to close it</p>