@@ -180,7 +180,8 @@ discard block |
||
| 180 | 180 | } |
| 181 | 181 | try { |
| 182 | 182 | $this->_storage = new $person_class($id); |
| 183 | - } catch (midgard_error_exception $e) { |
|
| 183 | + } |
|
| 184 | + catch (midgard_error_exception $e) { |
|
| 184 | 185 | debug_add("Failed to retrieve the person ID {$id}: " . $e->getMessage(), MIDCOM_LOG_INFO); |
| 185 | 186 | throw new midcom_error_midgard($e, $id); |
| 186 | 187 | } |
@@ -228,7 +229,8 @@ discard block |
||
| 228 | 229 | if (mgd_is_guid($id)) { |
| 229 | 230 | try { |
| 230 | 231 | return new $person_class($id); |
| 231 | - } catch (midgard_error_exception $e) { |
|
| 232 | + } |
|
| 233 | + catch (midgard_error_exception $e) { |
|
| 232 | 234 | debug_add("Failed to retrieve the person GUID {$id}: " . $e->getMessage(), MIDCOM_LOG_INFO); |
| 233 | 235 | throw new midcom_error_midgard($e, $id); |
| 234 | 236 | } |
@@ -98,7 +98,8 @@ |
||
| 98 | 98 | try { |
| 99 | 99 | $mgdschemaclass = $this->__mgdschema_class_name__; |
| 100 | 100 | $this->__object = new $mgdschemaclass($id); |
| 101 | - } catch (midgard_error_exception $e) { |
|
| 101 | + } |
|
| 102 | + catch (midgard_error_exception $e) { |
|
| 102 | 103 | debug_add('Constructing ' . $this->__mgdschema_class_name__ . ' object ' . $id . ' failed, reason: ' . $e->getMessage(), MIDCOM_LOG_WARN); |
| 103 | 104 | throw new midcom_error_midgard($e, $id); |
| 104 | 105 | } |
@@ -69,7 +69,8 @@ discard block |
||
| 69 | 69 | { |
| 70 | 70 | try { |
| 71 | 71 | $result = $this->_query->execute(); |
| 72 | - } catch (Exception $e) { |
|
| 72 | + } |
|
| 73 | + catch (Exception $e) { |
|
| 73 | 74 | debug_add("Query failed: " . $e->getMessage(), MIDCOM_LOG_ERROR); |
| 74 | 75 | return array(); |
| 75 | 76 | } |
@@ -90,7 +91,8 @@ discard block |
||
| 90 | 91 | $classname = $this->_real_class; |
| 91 | 92 | try { |
| 92 | 93 | $object = new $classname($object); |
| 93 | - } catch (midcom_error $e) { |
|
| 94 | + } |
|
| 95 | + catch (midcom_error $e) { |
|
| 94 | 96 | if ($e->getCode() == MIDCOM_ERRFORBIDDEN) { |
| 95 | 97 | $this->denied++; |
| 96 | 98 | } |
@@ -453,7 +453,8 @@ discard block |
||
| 453 | 453 | |
| 454 | 454 | try { |
| 455 | 455 | @exec($command, $output, $status); |
| 456 | - } catch (Exception $e) { |
|
| 456 | + } |
|
| 457 | + catch (Exception $e) { |
|
| 457 | 458 | debug_add($e->getMessage()); |
| 458 | 459 | } |
| 459 | 460 | |
@@ -549,7 +550,8 @@ discard block |
||
| 549 | 550 | |
| 550 | 551 | try { |
| 551 | 552 | $object = midcom::get()->dbfactory->get_object_by_guid($this->_guid); |
| 552 | - } catch (midcom_error $e) { |
|
| 553 | + } |
|
| 554 | + catch (midcom_error $e) { |
|
| 553 | 555 | debug_add("{$this->_guid} could not be resolved to object", MIDCOM_LOG_ERROR); |
| 554 | 556 | return false; |
| 555 | 557 | } |
@@ -787,7 +787,8 @@ discard block |
||
| 787 | 787 | $param = $param->__object; |
| 788 | 788 | } |
| 789 | 789 | $this->_user_cache[$id] = new midcom_core_user($param); |
| 790 | - } catch (midcom_error $e) { |
|
| 790 | + } |
|
| 791 | + catch (midcom_error $e) { |
|
| 791 | 792 | // Keep it silent while missing user object can mess here |
| 792 | 793 | $this->_user_cache[$id] = false; |
| 793 | 794 | } |
@@ -849,7 +850,8 @@ discard block |
||
| 849 | 850 | $tmp = new midcom_core_group($id); |
| 850 | 851 | $id = $tmp->id; |
| 851 | 852 | $this->_group_cache[$id] = $tmp; |
| 852 | - } catch (midcom_error $e) { |
|
| 853 | + } |
|
| 854 | + catch (midcom_error $e) { |
|
| 853 | 855 | $this->_group_cache[$id] = false; |
| 854 | 856 | debug_add("Group with identifier {$id} could not be loaded: " . $e->getMessage(), MIDCOM_LOG_WARN); |
| 855 | 857 | } |
@@ -135,7 +135,8 @@ discard block |
||
| 135 | 135 | |
| 136 | 136 | try { |
| 137 | 137 | return $this->_backend->index($documents); |
| 138 | - } catch (Exception $e) { |
|
| 138 | + } |
|
| 139 | + catch (Exception $e) { |
|
| 139 | 140 | debug_add("Indexing error: " . $e->getMessage(), MIDCOM_LOG_ERROR); |
| 140 | 141 | return false; |
| 141 | 142 | } |
@@ -175,7 +176,8 @@ discard block |
||
| 175 | 176 | } |
| 176 | 177 | try { |
| 177 | 178 | return $this->_backend->delete($RIs); |
| 178 | - } catch (Exception $e) { |
|
| 179 | + } |
|
| 180 | + catch (Exception $e) { |
|
| 179 | 181 | debug_add("Deleting error: " . $e->getMessage(), MIDCOM_LOG_ERROR); |
| 180 | 182 | return false; |
| 181 | 183 | } |
@@ -196,7 +198,8 @@ discard block |
||
| 196 | 198 | |
| 197 | 199 | try { |
| 198 | 200 | return $this->_backend->delete_all($constraint); |
| 199 | - } catch (Exception $e) { |
|
| 201 | + } |
|
| 202 | + catch (Exception $e) { |
|
| 200 | 203 | debug_add("Deleting error: " . $e->getMessage(), MIDCOM_LOG_ERROR); |
| 201 | 204 | return false; |
| 202 | 205 | } |
@@ -230,7 +233,8 @@ discard block |
||
| 230 | 233 | |
| 231 | 234 | try { |
| 232 | 235 | $result_raw = $this->_backend->query($query, $filter, $options); |
| 233 | - } catch (Exception $e) { |
|
| 236 | + } |
|
| 237 | + catch (Exception $e) { |
|
| 234 | 238 | debug_add("Query error: " . $e->getMessage(), MIDCOM_LOG_ERROR); |
| 235 | 239 | return false; |
| 236 | 240 | } |
@@ -256,7 +260,8 @@ discard block |
||
| 256 | 260 | if (!empty($document->topic_guid)) { |
| 257 | 261 | try { |
| 258 | 262 | midcom_db_topic::get_cached($document->topic_guid); |
| 259 | - } catch (midcom_error $e) { |
|
| 263 | + } |
|
| 264 | + catch (midcom_error $e) { |
|
| 260 | 265 | // Skip document, the object is hidden. |
| 261 | 266 | debug_add("Skipping the generic document {$document->title}, its topic seems to be invisible, we cannot proceed."); |
| 262 | 267 | continue; |
@@ -269,7 +274,8 @@ discard block |
||
| 269 | 274 | // Strip language code from end of RI if it looks like "<GUID>_<LANG>" |
| 270 | 275 | try { |
| 271 | 276 | midcom::get()->dbfactory->get_object_by_guid(preg_replace('/^([0-9a-f]{32,80})_[a-z]{2}$/', '\\1', $document->RI)); |
| 272 | - } catch (midcom_error $e) { |
|
| 277 | + } |
|
| 278 | + catch (midcom_error $e) { |
|
| 273 | 279 | // Skip document, the object is hidden, deleted or otherwise unavailable. |
| 274 | 280 | //@todo Maybe nonexistent objects should be removed from index? |
| 275 | 281 | continue; |
@@ -193,7 +193,8 @@ |
||
| 193 | 193 | $log_method = 'error'; |
| 194 | 194 | } |
| 195 | 195 | $this->firephp->$log_method($message); |
| 196 | - } catch (Exception $e) { |
|
| 196 | + } |
|
| 197 | + catch (Exception $e) { |
|
| 197 | 198 | // Ignore FirePHP errors for now |
| 198 | 199 | } |
| 199 | 200 | } |
@@ -735,7 +735,8 @@ |
||
| 735 | 735 | */ |
| 736 | 736 | try { |
| 737 | 737 | return $object->get_by_id($object->id); |
| 738 | - } catch (exception $e) { |
|
| 738 | + } |
|
| 739 | + catch (exception $e) { |
|
| 739 | 740 | return false; |
| 740 | 741 | } |
| 741 | 742 | } |
@@ -138,7 +138,8 @@ discard block |
||
| 138 | 138 | try { |
| 139 | 139 | $this->_object = new $classname($this->_id); |
| 140 | 140 | return $this->_object; |
| 141 | - } catch (Exception $e) { |
|
| 141 | + } |
|
| 142 | + catch (Exception $e) { |
|
| 142 | 143 | $this->_stop($e->getMessage(), $e->getCode()); |
| 143 | 144 | } |
| 144 | 145 | } |
@@ -211,7 +212,8 @@ discard block |
||
| 211 | 212 | if (is_null($this->_response)) { |
| 212 | 213 | $this->_stop('Could not handle request, unknown method', 405); |
| 213 | 214 | } |
| 214 | - } catch (midcom_error $e) { |
|
| 215 | + } |
|
| 216 | + catch (midcom_error $e) { |
|
| 215 | 217 | $this->_responseStatus = $e->getCode(); |
| 216 | 218 | return $this->_send_response($e->getMessage()); |
| 217 | 219 | } |