# HG changeset patch # User Tom Fredrik "BFG" Klaussen # Date 1350312748 -7200 # Node ID ff5fc61aa5ea501b46c8e226efacaa3b7fa81306 # Parent 4acaab0b02e2852cf23fe7cad73603c28d4d5c36 Throw only specific exceptions, eg. non of type Exception base. diff -r 4acaab0b02e2 -r ff5fc61aa5ea StatusCodes.inc --- a/StatusCodes.inc Mon Oct 15 16:51:07 2012 +0200 +++ b/StatusCodes.inc Mon Oct 15 16:52:28 2012 +0200 @@ -303,7 +303,7 @@ $matches = array(); preg_match('/HTTP\/\S+\s(\d+)/', $header, $matches); if (count($matches) < 1) - throw new Exception("Not an http header"); + throw new InvalidArgumentException("Not an http header"); $n = $matches[1]; return $n; } diff -r 4acaab0b02e2 -r ff5fc61aa5ea common-functions.inc --- a/common-functions.inc Mon Oct 15 16:51:07 2012 +0200 +++ b/common-functions.inc Mon Oct 15 16:52:28 2012 +0200 @@ -155,7 +155,7 @@ function getElementByTagName($obj, $name) { $elems = $obj->getElementsByTagName($name); if ($elems->length != 1) { - throw new Exception("More than one tag with name \"${name}\""); + throw new UnexpectedValueException("More than one tag with name \"${name}\""); } $elem = $elems->item(0); return $elem;