title: CakePHP: How can I catch mkdir error?
body: <p>I am currently using the following code in CakePHP 1.3.10 (using PHP 5.2.17) when mkdir returns false:</p>
  
  <pre><code>CakeLog::write('error', "An error occurred while creating the \"$target_dir\" directory.");
  </code></pre>
  
  <p>I would like to also capture the exact error message such as:</p>
  
  <pre><code>Warning (2): mkdir() [function.mkdir]: File exists
  </code></pre>
  
  <p>I could then include that error message in the log. How can I do that with CakePHP? I've tried using the <code>error_get_last</code> function, but it just says:</p>
  
  <pre><code>Non-static method Configure::getInstance() should not be called statically, assuming $this from incompatible context
  </code></pre>
  
  <p>Any help would be appreciated.</p>