Correct catching errors.
authorGunnar Wrobel <p@rdus.de>
Mon, 29 Jun 2009 05:44:07 +0000 (07:44 +0200)
committerGunnar Wrobel <p@rdus.de>
Mon, 29 Jun 2009 05:44:07 +0000 (07:44 +0200)
framework/Kolab_Format/lib/Horde/Kolab/Format/XML.php

index 4026512..080d161 100644 (file)
@@ -427,8 +427,9 @@ class Horde_Kolab_Format_XML
      */
     public function load(&$xmltext)
     {
-        $noderoot = $this->_parseXml($xmltext);
-        if (is_a($noderoot, 'PEAR_Error') || empty($noderoot)) {
+        try {
+            $noderoot = $this->_parseXml($xmltext);
+        } catch (Horde_Exception $e) {
             /**
              * If the first call does not return successfully this might mean we
              * got an attachment with broken encoding. There are some Kolab
@@ -442,10 +443,6 @@ class Horde_Kolab_Format_XML
             }
             $noderoot = $this->_parseXml($xmltext);
         }
-
-        if (is_a($noderoot, 'PEAR_Error')) {
-            throw new Horde_Exception($noderoot);
-        }
         if (empty($noderoot)) {
             return false;
         }