@@ -69,7 +69,8 @@ discard block |
||
69 | 69 | |
70 | 70 | try { |
71 | 71 | $result = $router->match($url); |
72 | - } catch (ResourceNotFoundException $e) { |
|
72 | + } |
|
73 | + catch (ResourceNotFoundException $e) { |
|
73 | 74 | throw new midcom_error_notfound('This URL method is unknown.'); |
74 | 75 | } |
75 | 76 | $this->request->attributes->add($result); |
@@ -151,11 +152,13 @@ discard block |
||
151 | 152 | |
152 | 153 | try { |
153 | 154 | $result = $router->match($url); |
154 | - } catch (ResourceNotFoundException $e) { |
|
155 | + } |
|
156 | + catch (ResourceNotFoundException $e) { |
|
155 | 157 | // No match |
156 | 158 | debug_add("Component {$viewer->_component} in {$viewer->_topic->name} declared unable to handle request.", MIDCOM_LOG_INFO); |
157 | 159 | throw new midcom_error_notfound("This page is not available on this server."); |
158 | - } catch (MethodNotAllowedException $e) { |
|
160 | + } |
|
161 | + catch (MethodNotAllowedException $e) { |
|
159 | 162 | debug_add("Component {$viewer->_component} in {$viewer->_topic->name} declared unable to handle request (method not allowed).", MIDCOM_LOG_INFO); |
160 | 163 | throw new midcom_error_forbidden($e->getMessage(), Response::HTTP_METHOD_NOT_ALLOWED); |
161 | 164 | } |
@@ -112,7 +112,8 @@ discard block |
||
112 | 112 | $row['approved'] = $object->is_approved() ? $object->metadata->approved : ''; |
113 | 113 | try { |
114 | 114 | $row['index_title'] = $reflector->get_object_label($object) ?: '[' . $this->_l10n->get('no title') . ']'; |
115 | - } catch (Exception $e) { |
|
115 | + } |
|
116 | + catch (Exception $e) { |
|
116 | 117 | $row['index_title'] = 'ERROR: ' . $e->getMessage(); |
117 | 118 | } |
118 | 119 | $link = $this->router->generate('object_' . $this->_request_data['default_mode'], ['guid' => $object->guid]); |
@@ -177,7 +178,8 @@ discard block |
||
177 | 178 | foreach ($guids as $guid) { |
178 | 179 | try { |
179 | 180 | $object = midcom::get()->dbfactory->get_object_by_guid($guid); |
180 | - } catch (midcom_error $e) { |
|
181 | + } |
|
182 | + catch (midcom_error $e) { |
|
181 | 183 | continue; |
182 | 184 | } |
183 | 185 | |
@@ -192,7 +194,8 @@ discard block |
||
192 | 194 | foreach ($guids as $guid) { |
193 | 195 | try { |
194 | 196 | $object = midcom::get()->dbfactory->get_object_by_guid($guid); |
195 | - } catch (midcom_error $e) { |
|
197 | + } |
|
198 | + catch (midcom_error $e) { |
|
196 | 199 | continue; |
197 | 200 | } |
198 | 201 |
@@ -119,7 +119,8 @@ discard block |
||
119 | 119 | try { |
120 | 120 | $creator = new midcom_db_person($view_metadata->get('creator')); |
121 | 121 | $creator_string = "<a href=\"" . midcom_connection::get_url('self') . "__mfa/asgard/object/view/{$creator->guid}/\">$creator->name</a>"; |
122 | - } catch (midcom_error $e) { |
|
122 | + } |
|
123 | + catch (midcom_error $e) { |
|
123 | 124 | $creator_string = $l10n->get('unknown person'); |
124 | 125 | } |
125 | 126 | $formatter = $data['l10n']->get_formatter(); |
@@ -133,7 +134,8 @@ discard block |
||
133 | 134 | try { |
134 | 135 | $editor = new midcom_db_person($view_metadata->get('revisor')); |
135 | 136 | $editor_string = "<a href=\"" . midcom_connection::get_url('self') . "__mfa/asgard/object/view/{$editor->guid}/\">$editor->name</a>"; |
136 | - } catch (midcom_error $e) { |
|
137 | + } |
|
138 | + catch (midcom_error $e) { |
|
137 | 139 | $editor_string = $l10n->get('unknown person'); |
138 | 140 | } |
139 | 141 |
@@ -73,7 +73,8 @@ |
||
73 | 73 | if ($stat instanceof midcom_services_indexer_client) { |
74 | 74 | try { |
75 | 75 | $stat->reindex(); |
76 | - } catch (RequestException $e) { |
|
76 | + } |
|
77 | + catch (RequestException $e) { |
|
77 | 78 | if ($e->hasResponse()) { |
78 | 79 | $crawler = new Crawler($e->getResponse()->getBody()->getContents()); |
79 | 80 | $body = $crawler->filterXPath('//body')->html(); |
@@ -123,7 +123,8 @@ |
||
123 | 123 | try { |
124 | 124 | $this->$function($request->request, $request->files); |
125 | 125 | $this->response['success'] = true; |
126 | - } catch (midcom_error $e) { |
|
126 | + } |
|
127 | + catch (midcom_error $e) { |
|
127 | 128 | $this->response['success'] = false; |
128 | 129 | $this->response['error'] = $e->getMessage(); |
129 | 130 | } |
@@ -33,7 +33,8 @@ |
||
33 | 33 | $member->require_do('midgard:update'); |
34 | 34 | $member->extra = $request->request->get('title'); |
35 | 35 | $response['status'] = $member->update(); |
36 | - } catch (midcom_error $e) { |
|
36 | + } |
|
37 | + catch (midcom_error $e) { |
|
37 | 38 | $e->log(); |
38 | 39 | } |
39 | 40 | $response['message'] = midcom_connection::get_error_string(); |
@@ -116,7 +116,8 @@ discard block |
||
116 | 116 | //TODO: check for duplicates ? |
117 | 117 | try { |
118 | 118 | $result = ['other_obj' => midcom::get()->dbfactory->get_object_by_guid($link[$other . 'Guid'])]; |
119 | - } catch (midcom_error $e) { |
|
119 | + } |
|
120 | + catch (midcom_error $e) { |
|
120 | 121 | continue; |
121 | 122 | } |
122 | 123 | $result['link'] = [ |
@@ -403,7 +404,8 @@ discard block |
||
403 | 404 | if (!($this->_object instanceof org_openpsa_relatedto_dba)) { |
404 | 405 | $response['status'] = "method requires guid of a link object as an argument"; |
405 | 406 | } |
406 | - } catch (midcom_error $e) { |
|
407 | + } |
|
408 | + catch (midcom_error $e) { |
|
407 | 409 | $response['status'] = "error: " . $e->getMessage(); |
408 | 410 | } |
409 | 411 | |
@@ -424,7 +426,8 @@ discard block |
||
424 | 426 | $relation = new org_openpsa_relatedto_dba($guid); |
425 | 427 | $result = $relation->delete(); |
426 | 428 | $status = 'Last message: ' . midcom_connection::get_error_string(); |
427 | - } catch (midcom_error $e) { |
|
429 | + } |
|
430 | + catch (midcom_error $e) { |
|
428 | 431 | $result = false; |
429 | 432 | $status = "Object '{$guid}' could not be loaded, error:" . $e->getMessage(); |
430 | 433 | } |
@@ -79,7 +79,8 @@ |
||
79 | 79 | if (!array_key_exists($id, $this->_user_cache)) { |
80 | 80 | try { |
81 | 81 | $this->_user_cache[$id] = new midcom_core_user($param); |
82 | - } catch (midcom_error $e) { |
|
82 | + } |
|
83 | + catch (midcom_error $e) { |
|
83 | 84 | // Keep it silent while missing user object can mess here |
84 | 85 | $this->_user_cache[$id] = null; |
85 | 86 | } |
@@ -56,7 +56,8 @@ |
||
56 | 56 | try { |
57 | 57 | $backend->update(midcom::get()->auth->user->id ?? 'NOBODY', $message); |
58 | 58 | return true; |
59 | - } catch (midcom_error $e) { |
|
59 | + } |
|
60 | + catch (midcom_error $e) { |
|
60 | 61 | debug_add('RCS: Could not save file!'); |
61 | 62 | $e->log(); |
62 | 63 | return false; |