title: Custom messages for php exception handling
body: <p>I'm using an external file with $errmsg array for displaying errors, like:</p>
  
  <pre><code>'app_init' =&gt; 'Cannot initialize application',
  </code></pre>
  
  <p>Using conditionals, I call the function to display the message on failure:</p>
  
  <pre><code>if(!$condition)
  {
  $arraywithmessages-&gt;functionforfiltering($err,'app_init',$aim);
  }
  </code></pre>
  
  <p>...where $err is the array of messages, and $aim is predefined method of publishing error (e-mail, view, etc...)</p>
  
  <p>Now I'd like to make use of Exception Handling, but I don't know where to start. Can anyone help? This doesn't seem to work:</p>
  
  <pre><code>try {
  if (!$condition) {
  throw new Exception('app_init');
  }
  // continue
  } catch (Exception $e) {
  $arraywithmessages-&gt;functionforfiltering($err,$e-&gt;getMessage(),$aim);
  }
  </code></pre>