Mercurial > SimpleWebPresenter
comparison common-functions.inc @ 83:ff5fc61aa5ea
Throw only specific exceptions, eg. non of type Exception base.
| author | Tom Fredrik "BFG" Klaussen <bfg@blenning.no> |
|---|---|
| date | Mon, 15 Oct 2012 16:52:28 +0200 |
| parents | 947d53f95ccd |
| children | 7a9c45b53866 |
comparison
equal
deleted
inserted
replaced
| 82:4acaab0b02e2 | 83:ff5fc61aa5ea |
|---|---|
| 153 * @param $name the name of the element to search for | 153 * @param $name the name of the element to search for |
| 154 */ | 154 */ |
| 155 function getElementByTagName($obj, $name) { | 155 function getElementByTagName($obj, $name) { |
| 156 $elems = $obj->getElementsByTagName($name); | 156 $elems = $obj->getElementsByTagName($name); |
| 157 if ($elems->length != 1) { | 157 if ($elems->length != 1) { |
| 158 throw new Exception("More than one tag with name \"${name}\""); | 158 throw new UnexpectedValueException("More than one tag with name \"${name}\""); |
| 159 } | 159 } |
| 160 $elem = $elems->item(0); | 160 $elem = $elems->item(0); |
| 161 return $elem; | 161 return $elem; |
| 162 } | 162 } |
| 163 | 163 |
