@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Replace usages of PhutilProxyException

Summary:
This exception only exists for backwards compatibility with PHP versions
older than 5.3.0.
See https://www.php.net/manual/en/exception.getprevious.php and
https://we.phorge.it/rARC08432f5a24b3ead31c18623785daf5f985c8cfa5

Test Plan: Throw an exception with a nested exception and look at the error page.

Reviewers: O1 Blessed Committers, aklapper

Reviewed By: O1 Blessed Committers, aklapper

Subscribers: aklapper, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15904

Differential Revision: https://we.phorge.it/D25957

+78 -40
+2 -1
resources/sql/autopatches/20210215.changeset.02.phid-populate.php
··· 19 19 changeset_phid VARBINARY(64) NOT NULL)', 20 20 $temporary_table); 21 21 } catch (AphrontAccessDeniedQueryException $ex) { 22 - throw new PhutilProxyException( 22 + throw new Exception( 23 23 pht( 24 24 'Failed to "CREATE TEMPORARY TABLE". You may need to "GRANT" the '. 25 25 'current MySQL user this permission.'), 26 + 0, 26 27 $ex); 27 28 } 28 29
+2 -1
resources/sql/autopatches/20210802.legalpad_document_signature.02.phid-populate.php
··· 19 19 docsig_phid VARBINARY(64) NOT NULL)', 20 20 $temporary_table); 21 21 } catch (AphrontAccessDeniedQueryException $ex) { 22 - throw new PhutilProxyException( 22 + throw new Exception( 23 23 pht( 24 24 'Failed to "CREATE TEMPORARY TABLE". You may need to "GRANT" the '. 25 25 'current MySQL user this permission.'), 26 + 0, 26 27 $ex); 27 28 } 28 29
+2 -1
src/applications/auth/adapter/PhutilAmazonAuthAdapter.php
··· 71 71 try { 72 72 return phutil_json_decode($body); 73 73 } catch (PhutilJSONParserException $ex) { 74 - throw new PhutilProxyException( 74 + throw new Exception( 75 75 pht('Expected valid JSON response from Amazon account data request.'), 76 + 0, 76 77 $ex); 77 78 } 78 79 }
+2 -1
src/applications/auth/adapter/PhutilDisqusAuthAdapter.php
··· 75 75 $data = phutil_json_decode($body); 76 76 return $data['response']; 77 77 } catch (PhutilJSONParserException $ex) { 78 - throw new PhutilProxyException( 78 + throw new Exception( 79 79 pht('Expected valid JSON response from Disqus account data request.'), 80 + 0, 80 81 $ex); 81 82 } 82 83 }
+2 -1
src/applications/auth/adapter/PhutilFacebookAuthAdapter.php
··· 80 80 try { 81 81 $data = phutil_json_decode($body); 82 82 } catch (PhutilJSONParserException $ex) { 83 - throw new PhutilProxyException( 83 + throw new Exception( 84 84 pht('Expected valid JSON response from Facebook account data request.'), 85 + 0, 85 86 $ex); 86 87 } 87 88
+2 -1
src/applications/auth/adapter/PhutilGitHubAuthAdapter.php
··· 68 68 try { 69 69 return phutil_json_decode($body); 70 70 } catch (PhutilJSONParserException $ex) { 71 - throw new PhutilProxyException( 71 + throw new Exception( 72 72 pht('Expected valid JSON response from GitHub account data request.'), 73 + 0, 73 74 $ex); 74 75 } 75 76 }
+2 -1
src/applications/auth/adapter/PhutilGoogleAuthAdapter.php
··· 109 109 try { 110 110 $result = phutil_json_decode($body); 111 111 } catch (PhutilJSONParserException $ex) { 112 - throw new PhutilProxyException( 112 + throw new Exception( 113 113 pht('Expected valid JSON response from Google account data request.'), 114 + 0, 114 115 $ex); 115 116 } 116 117
+2 -1
src/applications/auth/future/PhabricatorDuoFuture.php
··· 143 143 try { 144 144 $data = phutil_json_decode($body); 145 145 } catch (PhutilJSONParserException $ex) { 146 - throw new PhutilProxyException( 146 + throw new Exception( 147 147 pht('Expected JSON response from Duo.'), 148 + 0, 148 149 $ex); 149 150 } 150 151
+2 -1
src/applications/auth/sshkey/PhabricatorAuthSSHPublicKey.php
··· 130 130 $tmp); 131 131 } catch (CommandException $ex) { 132 132 unset($tmp); 133 - throw new PhutilProxyException( 133 + throw new Exception( 134 134 pht( 135 135 'Failed to convert public key into PKCS8 format. If you are '. 136 136 'developing on OSX, you may be able to use `%s` '. 137 137 'to work around this issue. %s', 138 138 'bin/auth cache-pkcs8', 139 139 $ex->getMessage()), 140 + 0, 140 141 $ex); 141 142 } 142 143 unset($tmp);
+2 -1
src/applications/conduit/controller/PhabricatorConduitAPIController.php
··· 689 689 try { 690 690 $params = phutil_json_decode($params_json); 691 691 } catch (PhutilJSONParserException $ex) { 692 - throw new PhutilProxyException( 692 + throw new Exception( 693 693 pht( 694 694 "Invalid parameter information was passed to method '%s'.", 695 695 $method), 696 + 0, 696 697 $ex); 697 698 } 698 699
+2 -1
src/applications/conduit/ssh/ConduitSSHWorkflow.php
··· 30 30 try { 31 31 $raw_params = phutil_json_decode($json); 32 32 } catch (PhutilJSONParserException $ex) { 33 - throw new PhutilProxyException( 33 + throw new Exception( 34 34 pht('Invalid JSON input.'), 35 + 0, 35 36 $ex); 36 37 } 37 38
+2 -1
src/applications/differential/__tests__/DifferentialParseRenderTestCase.php
··· 24 24 try { 25 25 $options = phutil_json_decode($options); 26 26 } catch (PhutilJSONParserException $ex) { 27 - throw new PhutilProxyException( 27 + throw new Exception( 28 28 pht('Invalid options file: %s.', $opt_file), 29 + 0, 29 30 $ex); 30 31 } 31 32 } else {
+4 -2
src/applications/diffusion/protocol/DiffusionRepositoryClusterEngine.php
··· 189 189 'Acquired read lock immediately.')); 190 190 } 191 191 } catch (PhutilLockException $ex) { 192 - throw new PhutilProxyException( 192 + throw new Exception( 193 193 pht( 194 194 'Failed to acquire read lock after waiting %s second(s). You '. 195 195 'may be able to retry later. (%s)', 196 196 new PhutilNumber($lock_wait), 197 197 $ex->getHint()), 198 + 0, 198 199 $ex); 199 200 } 200 201 ··· 379 380 'Acquired write lock immediately.')); 380 381 } 381 382 } catch (PhutilLockException $ex) { 382 - throw new PhutilProxyException( 383 + throw new Exception( 383 384 pht( 384 385 'Failed to acquire write lock after waiting %s second(s). You '. 385 386 'may be able to retry later. (%s)', 386 387 new PhutilNumber($lock_wait), 387 388 $ex->getHint()), 389 + 0, 388 390 $ex); 389 391 } 390 392
+2 -1
src/applications/doorkeeper/bridge/DoorkeeperBridge.php
··· 75 75 ->withObjectKeys(array($ref->getObjectKey())) 76 76 ->executeOne(); 77 77 if (!$obj) { 78 - throw new PhutilProxyException( 78 + throw new Exception( 79 79 pht('Failed to load external object after collision.'), 80 + 0, 80 81 $ex); 81 82 } 82 83
+2 -1
src/applications/drydock/worker/DrydockLeaseUpdateWorker.php
··· 1066 1066 case DrydockLeaseStatus::STATUS_BROKEN: 1067 1067 case DrydockLeaseStatus::STATUS_RELEASED: 1068 1068 case DrydockLeaseStatus::STATUS_DESTROYED: 1069 - throw new PhutilProxyException( 1069 + throw new Exception( 1070 1070 pht( 1071 1071 'Unexpected failure while destroying lease ("%s").', 1072 1072 $lease->getPHID()), 1073 + 0, 1073 1074 $ex); 1074 1075 } 1075 1076
+2 -1
src/applications/drydock/worker/DrydockResourceUpdateWorker.php
··· 266 266 case DrydockResourceStatus::STATUS_DESTROYED: 267 267 // If the resource was already broken, just throw a normal exception. 268 268 // This will retry the task eventually. 269 - throw new PhutilProxyException( 269 + throw new Exception( 270 270 pht( 271 271 'Unexpected failure while destroying resource ("%s").', 272 272 $resource->getPHID()), 273 + 0, 273 274 $ex); 274 275 } 275 276
+2 -2
src/applications/drydock/worker/DrydockWorker.php
··· 151 151 } 152 152 } 153 153 154 - if ($ex instanceof PhutilProxyException) { 155 - return $this->isTemporaryException($ex->getPreviousException()); 154 + if ($ex->getPrevious()) { 155 + return $this->isTemporaryException($ex->getPrevious()); 156 156 } 157 157 158 158 return false;
+2 -1
src/applications/files/storage/PhabricatorFile.php
··· 683 683 } 684 684 } catch (Exception $ex) { 685 685 if ($redirects) { 686 - throw new PhutilProxyException( 686 + throw new Exception( 687 687 pht( 688 688 'Failed to fetch remote URI "%s" after following %s redirect(s) '. 689 689 '(%s): %s', ··· 691 691 phutil_count($redirects), 692 692 implode(' > ', array_keys($redirects)), 693 693 $ex->getMessage()), 694 + 0, 694 695 $ex); 695 696 } else { 696 697 throw $ex;
+2 -1
src/applications/herald/controller/HeraldRuleController.php
··· 286 286 try { 287 287 $data = phutil_json_decode($request->getStr('rule')); 288 288 } catch (PhutilJSONParserException $ex) { 289 - throw new PhutilProxyException( 289 + throw new Exception( 290 290 pht('Failed to decode rule data.'), 291 + 0, 291 292 $ex); 292 293 } 293 294
+2 -1
src/applications/metamta/adapter/PhabricatorMailMailgunAdapter.php
··· 119 119 try { 120 120 $response = phutil_json_decode($body); 121 121 } catch (PhutilJSONParserException $ex) { 122 - throw new PhutilProxyException( 122 + throw new Exception( 123 123 pht('Failed to JSON decode response.'), 124 + 0, 124 125 $ex); 125 126 } 126 127
+2 -1
src/applications/metamta/future/PhabricatorTwilioFuture.php
··· 89 89 try { 90 90 $data = phutil_json_decode($body); 91 91 } catch (PhutilJSONParserException $ex) { 92 - throw new PhutilProxyException( 92 + throw new Exception( 93 93 pht('Expected JSON response from Twilio.'), 94 + 0, 94 95 $ex); 95 96 } 96 97
+2 -1
src/applications/nuance/github/__tests__/NuanceGitHubRawEventTestCase.php
··· 95 95 $input = phutil_json_decode($input); 96 96 $expect = phutil_json_decode($expect); 97 97 } catch (Exception $ex) { 98 - throw new PhutilProxyException( 98 + throw new Exception( 99 99 pht( 100 100 'Exception while decoding test data for test "%s".', 101 101 $file), 102 + 0, 102 103 $ex); 103 104 } 104 105
+2 -1
src/applications/policy/controller/PhabricatorPolicyEditController.php
··· 91 91 try { 92 92 $data = phutil_json_decode($data); 93 93 } catch (PhutilJSONParserException $ex) { 94 - throw new PhutilProxyException( 94 + throw new Exception( 95 95 pht('Failed to JSON decode rule data!'), 96 + 0, 96 97 $ex); 97 98 } 98 99
+2 -1
src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php
··· 495 495 try { 496 496 list($stdout, $stderr) = $future->resolvex(); 497 497 } catch (Exception $ex) { 498 - $proxy = new PhutilProxyException( 498 + $proxy = new Exception( 499 499 pht( 500 500 'Error while updating the "%s" repository.', 501 501 $display_name), 502 + 0, 502 503 $ex); 503 504 phlog($proxy); 504 505
+2 -1
src/applications/repository/management/PhabricatorRepositoryManagementUpdateWorkflow.php
··· 126 126 } catch (Exception $ex) { 127 127 // TODO: We should report these into the UI properly, but for now just 128 128 // complain. These errors are much less severe than pull errors. 129 - $proxy = new PhutilProxyException( 129 + $proxy = new Exception( 130 130 pht( 131 131 'Error while pushing "%s" repository to mirrors.', 132 132 $repository->getMonogram()), 133 + 0, 133 134 $ex); 134 135 phlog($proxy); 135 136 }
+2 -1
src/applications/search/fulltextstorage/PhabricatorElasticFulltextStorageEngine.php
··· 533 533 return $data; 534 534 } catch (PhutilJSONParserException $ex) { 535 535 $host->didHealthCheck(false); 536 - throw new PhutilProxyException( 536 + throw new Exception( 537 537 pht('Elasticsearch server returned invalid JSON!'), 538 + 0, 538 539 $ex); 539 540 } 540 541
+2 -1
src/applications/transactions/editengine/PhabricatorEditEngine.php
··· 2295 2295 $value = $type->getTransactionValueFromConduit($value); 2296 2296 $xaction['value'] = $value; 2297 2297 } catch (Exception $ex) { 2298 - throw new PhutilProxyException( 2298 + throw new Exception( 2299 2299 pht( 2300 2300 'Exception when processing transaction of type "%s": %s', 2301 2301 $xaction['type'], 2302 2302 $ex->getMessage()), 2303 + 0, 2303 2304 $ex); 2304 2305 } 2305 2306
+2 -1
src/applications/xhprof/controller/PhabricatorXHProfProfileController.php
··· 22 22 try { 23 23 $data = phutil_json_decode($data); 24 24 } catch (PhutilJSONParserException $ex) { 25 - throw new PhutilProxyException( 25 + throw new Exception( 26 26 pht('Failed to unserialize XHProf profile!'), 27 + 0, 27 28 $ex); 28 29 } 29 30
+4 -2
src/infrastructure/daemon/workers/PhabricatorTaskmasterDaemon.php
··· 25 25 if ($ex instanceof PhabricatorWorkerPermanentFailureException) { 26 26 // NOTE: Make sure these reach the daemon log, even when not 27 27 // running in verbose mode. See T12803 for discussion. 28 - $log_exception = new PhutilProxyException( 28 + $log_exception = new Exception( 29 29 pht( 30 30 'Task "%s" encountered a permanent failure and was '. 31 31 'cancelled.', 32 32 $id), 33 + 0, 33 34 $ex); 34 35 phlog($log_exception); 35 36 } else if ($ex instanceof PhabricatorWorkerYieldException) { 36 37 $this->log(pht('Task %s yielded.', $id)); 37 38 } else { 38 39 $this->log(pht('Task %d failed!', $id)); 39 - throw new PhutilProxyException( 40 + throw new Exception( 40 41 pht('Error while executing Task ID %d.', $id), 42 + 0, 41 43 $ex); 42 44 } 43 45 } else {
+2 -1
src/infrastructure/daemon/workers/PhabricatorTriggerDaemon.php
··· 78 78 try { 79 79 $lock->lock(5); 80 80 } catch (PhutilLockException $ex) { 81 - throw new PhutilProxyException( 81 + throw new Exception( 82 82 pht( 83 83 'Another process is holding the trigger lock. Usually, this '. 84 84 'means another copy of the trigger daemon is running elsewhere. '. 85 85 'Multiple processes are not permitted to update triggers '. 86 86 'simultaneously.'), 87 + 0, 87 88 $ex); 88 89 } 89 90
+2 -1
src/infrastructure/daemon/workers/PhabricatorWorker.php
··· 169 169 $task_result = PhabricatorWorkerArchiveTask::RESULT_SUCCESS; 170 170 break; 171 171 } catch (PhabricatorWorkerPermanentFailureException $ex) { 172 - $proxy = new PhutilProxyException( 172 + $proxy = new Exception( 173 173 pht( 174 174 'In-process task ("%s") failed permanently.', 175 175 $task_class), 176 + 0, 176 177 $ex); 177 178 178 179 phlog($proxy);
+4 -2
src/infrastructure/env/PhabricatorConfigLocalSource.php
··· 29 29 try { 30 30 $data = Filesystem::readFile($path); 31 31 } catch (FilesystemException $ex) { 32 - throw new PhutilProxyException( 32 + throw new Exception( 33 33 pht( 34 34 'Configuration file "%s" exists, but could not be read.', 35 35 $path), 36 + 0, 36 37 $ex); 37 38 } 38 39 39 40 try { 40 41 $result = phutil_json_decode($data); 41 42 } catch (PhutilJSONParserException $ex) { 42 - throw new PhutilProxyException( 43 + throw new Exception( 43 44 pht( 44 45 'Configuration file "%s" exists and is readable, but the content '. 45 46 'is not valid JSON. You may have edited this file manually and '. 46 47 'introduced a syntax error by mistake. Correct the file syntax '. 47 48 'to continue.', 48 49 $path), 50 + 0, 49 51 $ex); 50 52 } 51 53
+2 -1
src/infrastructure/storage/lisk/LiskDAO.php
··· 1095 1095 $data[$key] = qsprintf($conn, '%ns', $value); 1096 1096 } 1097 1097 } catch (AphrontParameterQueryException $parameter_exception) { 1098 - throw new PhutilProxyException( 1098 + throw new Exception( 1099 1099 pht( 1100 1100 "Unable to insert or update object of class %s, field '%s' ". 1101 1101 "has a non-scalar value.", 1102 1102 get_class($this), 1103 1103 $key), 1104 + 0, 1104 1105 $parameter_exception); 1105 1106 } 1106 1107 }
+2 -1
src/infrastructure/storage/lisk/PhabricatorLiskDAO.php
··· 114 114 // If we ended up here as the result of a failover, log the 115 115 // exception. This is seriously bad news even if we are able 116 116 // to recover from it. 117 - $proxy_exception = new PhutilProxyException( 117 + $proxy_exception = new Exception( 118 118 pht( 119 119 'Failed to connect to master database ("%s"), failing over '. 120 120 'into read-only mode.', 121 121 $database), 122 + 0, 122 123 $master_exception); 123 124 phlog($proxy_exception); 124 125 }
+4 -2
src/infrastructure/storage/management/PhabricatorStorageManagementAPI.php
··· 147 147 self::TABLE_STATUS); 148 148 return ipull($applied, 'patch'); 149 149 } catch (AphrontAccessDeniedQueryException $ex) { 150 - throw new PhutilProxyException( 150 + throw new Exception( 151 151 pht( 152 152 'Failed while trying to read schema status: the database "%s" '. 153 153 'exists, but the current user ("%s") does not have permission to '. ··· 155 155 'different user.', 156 156 $this->getDatabaseName('meta_data'), 157 157 $this->getUser()), 158 + 0, 158 159 $ex); 159 160 } catch (AphrontQueryException $ex) { 160 161 return null; ··· 284 285 // avoiding it since we're executing raw text files full of SQL. 285 286 queryfx($conn, '%Z', $query); 286 287 } catch (AphrontAccessDeniedQueryException $ex) { 287 - throw new PhutilProxyException( 288 + throw new Exception( 288 289 pht( 289 290 'Unable to access a required database or table. This almost '. 290 291 'always means that the user you are connecting with ("%s") does '. ··· 292 293 'use `bin/storage databases` to get a list of all databases '. 293 294 'permission is required on.', 294 295 $this->getUser()), 296 + 0, 295 297 $ex); 296 298 } 297 299 }