Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Merge branch 'merges/rettal-exceptions-dom' into local/milestones/exc…
Browse files Browse the repository at this point in the history
…eptions
  • Loading branch information
Ralph Schindler committed Sep 30, 2010
6 parents cfbc839 + 49e4d7c + ff81391 + 21cca29 + f0671be + 499e6b4 commit 7624c04
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Exception.php
Expand Up @@ -33,6 +33,6 @@
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Exception extends \Zend\Exception
interface Exception
{
}
}
38 changes: 38 additions & 0 deletions src/Exception/RuntimeException.php
@@ -0,0 +1,38 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dom
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/

/**
* @namespace
*/
namespace Zend\Dom\Exception;

/**
* Zend_Dom Exceptions
*
* @uses \Zend\Dom\Exception
* @category Zend
* @package Zend_Dom
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class RuntimeException extends \RuntimeException implements \Zend\Dom\Exception
{
}
6 changes: 3 additions & 3 deletions src/Query.php
Expand Up @@ -190,7 +190,7 @@ public function execute($query)
public function queryXpath($xpathQuery, $query = null)
{
if (null === ($document = $this->getDocument())) {
throw new Exception('Cannot query; no document registered');
throw new Exception\RuntimeException('Cannot query; no document registered');
}

libxml_use_internal_errors(true);
Expand All @@ -214,7 +214,7 @@ public function queryXpath($xpathQuery, $query = null)
libxml_use_internal_errors(false);

if (!$success) {
throw new Exception(sprintf('Error parsing document (type == %s)', $type));
throw new Exception\RuntimeException(sprintf('Error parsing document (type == %s)', $type));
}

$nodeList = $this->_getNodeList($domDoc, $xpathQuery);
Expand Down Expand Up @@ -248,4 +248,4 @@ protected function _getNodeList($document, $xpathQuery)
$xpathQuery = (string) $xpathQuery;
return $xpath->query($xpathQuery);
}
}
}
2 changes: 1 addition & 1 deletion test/QueryTest.php
Expand Up @@ -127,7 +127,7 @@ public function testDocumentTypeShouldBeAutomaticallyDiscovered()

public function testQueryingWithoutRegisteringDocumentShouldThrowException()
{
$this->setExpectedException('\\Zend\\Dom\\Exception', 'no document');
$this->setExpectedException('\Zend\Dom\Exception\RuntimeException', 'no document');
$this->query->execute('.foo');
}

Expand Down

0 comments on commit 7624c04

Please sign in to comment.