title: Get error of specific function
body: <p>I am using <a href="https://github.com/cybermonde/odtphp" rel="nofollow">odtphp library</a> to create custom <code>.odt</code> file.</p>
  
  <p>In this library there is a function to save the <code>.odt</code> on disk</p>
  
  <pre><code>public function saveToDisk($file = null)
  {
      if ($file !== null &amp;&amp; is_string($file)) {
       if (file_exists($file) &amp;&amp; !(is_file($file) &amp;&amp; is_writable($file))) {
           throw new OdfException('Permission denied : can\'t create ' . $file);
       }
          $this-&gt;_save();
          copy($this-&gt;tmpfile, $file);     
      } else {
          $this-&gt;_save();
      }
  }
  </code></pre>
  
  <p>It works perfectly but I can not figure out how to get the error message (by exemple when the doc is already open by someone else)</p>
  
  <p>I'm trying this</p>
  
  <pre><code>try
  {
      $odf-&gt;saveToDisk('test.odt');
  }
  catch(OdfException $e )
  {
      echo $e-&gt;getMessage();
  }
  </code></pre>
  
  <p>But it give me the whole PHP error (with orange background) instead of the <code>Permission denied</code></p>
  
  <h2>Edit</h2>
  
  <p>This is the PHP error that I get (with orange background)</p>
  
  <pre><code>&lt;br /&gt;
  &lt;font size='1'&gt;&lt;table class='xdebug-error xe-warning' dir='ltr' border='1' cellspacing='0' cellpadding
  ='1'&gt;
  &lt;tr&gt;&lt;th align='left' bgcolor='#f57900' colspan="5"&gt;&lt;span style='background-color: #cc0000; color: #fce94f
  ; font-size: x-large;'&gt;( ! )&lt;/span&gt; Warning: copy(Test.odt): failed to open stream: Permission denied in
   Path\To\odtphp-master\library\Odf.php on line &lt;i&gt;259&lt;/i&gt;&lt;/th&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;th align='left' bgcolor='#e9b96e' colspan='5'&gt;Call Stack&lt;/th&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;th align='center' bgcolor='#eeeeec'&gt;#&lt;/th&gt;&lt;th align='left' bgcolor='#eeeeec'&gt;Time&lt;/th&gt;&lt;th align
  ='left' bgcolor='#eeeeec'&gt;Memory&lt;/th&gt;&lt;th align='left' bgcolor='#eeeeec'&gt;Function&lt;/th&gt;&lt;th align='left'
   bgcolor='#eeeeec'&gt;Location&lt;/th&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td bgcolor='#eeeeec' align='center'&gt;1&lt;/td&gt;&lt;td bgcolor='#eeeeec' align='center'&gt;0.0012&lt;/td&gt;&lt;td bgcolor
  ='#eeeeec' align='right'&gt;262008&lt;/td&gt;&lt;td bgcolor='#eeeeec'&gt;{main}(  )&lt;/td&gt;&lt;td title='Path\To\test.php' bgcolor='#eeeeec'&gt;..\test.php&lt;b&gt;:&lt;/b&gt;0&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td bgcolor='#eeeeec' align='center'&gt;2&lt;/td&gt;&lt;td bgcolor='#eeeeec' align='center'&gt;0.1992&lt;/td&gt;&lt;td bgcolor
  ='#eeeeec' align='right'&gt;1872248&lt;/td&gt;&lt;td bgcolor='#eeeeec'&gt;Odf-&gt;saveToDisk(  )&lt;/td&gt;&lt;td title='Path\To\test.php' bgcolor='#eeeeec'&gt;..\test.php&lt;b&gt;:&lt;/b&gt;75&lt;/td&gt;&lt;
  /tr&gt;
  &lt;tr&gt;&lt;td bgcolor='#eeeeec' align='center'&gt;3&lt;/td&gt;&lt;td bgcolor='#eeeeec' align='center'&gt;0.2434&lt;/td&gt;&lt;td bgcolor
  ='#eeeeec' align='right'&gt;2109632&lt;/td&gt;&lt;td bgcolor='#eeeeec'&gt;&lt;a href='http://www.php.net/function.copy'
   target='_new'&gt;copy&lt;/a&gt;
  (  )&lt;/td&gt;&lt;td title='Path\To\odtphp-master\library\Odf.php' bgcolor='#eeeeec'&gt;..\Odf.php
  &lt;b&gt;:&lt;/b&gt;259&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;&lt;/font&gt;
  </code></pre>