From bf2dc119477810aafbff1de521197b6589eda5bc Mon Sep 17 00:00:00 2001 From: mainframe98 Date: Wed, 9 Apr 2025 20:05:52 +0200 Subject: [PATCH] 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 --- .../sql/autopatches/20210215.changeset.02.phid-populate.php | 3 ++- ...0210802.legalpad_document_signature.02.phid-populate.php | 3 ++- src/applications/auth/adapter/PhutilAmazonAuthAdapter.php | 3 ++- src/applications/auth/adapter/PhutilDisqusAuthAdapter.php | 3 ++- src/applications/auth/adapter/PhutilFacebookAuthAdapter.php | 3 ++- src/applications/auth/adapter/PhutilGitHubAuthAdapter.php | 3 ++- src/applications/auth/adapter/PhutilGoogleAuthAdapter.php | 3 ++- src/applications/auth/future/PhabricatorDuoFuture.php | 3 ++- .../auth/sshkey/PhabricatorAuthSSHPublicKey.php | 3 ++- .../conduit/controller/PhabricatorConduitAPIController.php | 3 ++- src/applications/conduit/ssh/ConduitSSHWorkflow.php | 3 ++- .../__tests__/DifferentialParseRenderTestCase.php | 3 ++- .../diffusion/protocol/DiffusionRepositoryClusterEngine.php | 6 ++++-- src/applications/doorkeeper/bridge/DoorkeeperBridge.php | 3 ++- .../drydock/worker/DrydockLeaseUpdateWorker.php | 3 ++- .../drydock/worker/DrydockResourceUpdateWorker.php | 3 ++- src/applications/drydock/worker/DrydockWorker.php | 4 ++-- src/applications/files/storage/PhabricatorFile.php | 3 ++- src/applications/herald/controller/HeraldRuleController.php | 3 ++- .../metamta/adapter/PhabricatorMailMailgunAdapter.php | 3 ++- src/applications/metamta/future/PhabricatorTwilioFuture.php | 3 ++- .../github/__tests__/NuanceGitHubRawEventTestCase.php | 3 ++- .../policy/controller/PhabricatorPolicyEditController.php | 3 ++- .../daemon/PhabricatorRepositoryPullLocalDaemon.php | 3 ++- .../PhabricatorRepositoryManagementUpdateWorkflow.php | 3 ++- .../PhabricatorElasticFulltextStorageEngine.php | 3 ++- .../transactions/editengine/PhabricatorEditEngine.php | 3 ++- .../controller/PhabricatorXHProfProfileController.php | 3 ++- .../daemon/workers/PhabricatorTaskmasterDaemon.php | 6 ++++-- .../daemon/workers/PhabricatorTriggerDaemon.php | 3 ++- src/infrastructure/daemon/workers/PhabricatorWorker.php | 3 ++- src/infrastructure/env/PhabricatorConfigLocalSource.php | 6 ++++-- src/infrastructure/storage/lisk/LiskDAO.php | 3 ++- src/infrastructure/storage/lisk/PhabricatorLiskDAO.php | 3 ++- .../storage/management/PhabricatorStorageManagementAPI.php | 6 ++++-- 35 files changed, 78 insertions(+), 40 deletions(-) diff --git a/resources/sql/autopatches/20210215.changeset.02.phid-populate.php b/resources/sql/autopatches/20210215.changeset.02.phid-populate.php index 93f886c7b0..25254258de 100644 --- a/resources/sql/autopatches/20210215.changeset.02.phid-populate.php +++ b/resources/sql/autopatches/20210215.changeset.02.phid-populate.php @@ -19,10 +19,11 @@ try { changeset_phid VARBINARY(64) NOT NULL)', $temporary_table); } catch (AphrontAccessDeniedQueryException $ex) { - throw new PhutilProxyException( + throw new Exception( pht( 'Failed to "CREATE TEMPORARY TABLE". You may need to "GRANT" the '. 'current MySQL user this permission.'), + 0, $ex); } diff --git a/resources/sql/autopatches/20210802.legalpad_document_signature.02.phid-populate.php b/resources/sql/autopatches/20210802.legalpad_document_signature.02.phid-populate.php index 1a2ce50293..1129872b34 100644 --- a/resources/sql/autopatches/20210802.legalpad_document_signature.02.phid-populate.php +++ b/resources/sql/autopatches/20210802.legalpad_document_signature.02.phid-populate.php @@ -19,10 +19,11 @@ try { docsig_phid VARBINARY(64) NOT NULL)', $temporary_table); } catch (AphrontAccessDeniedQueryException $ex) { - throw new PhutilProxyException( + throw new Exception( pht( 'Failed to "CREATE TEMPORARY TABLE". You may need to "GRANT" the '. 'current MySQL user this permission.'), + 0, $ex); } diff --git a/src/applications/auth/adapter/PhutilAmazonAuthAdapter.php b/src/applications/auth/adapter/PhutilAmazonAuthAdapter.php index 94c529ae2d..cc9dbc55d9 100644 --- a/src/applications/auth/adapter/PhutilAmazonAuthAdapter.php +++ b/src/applications/auth/adapter/PhutilAmazonAuthAdapter.php @@ -71,8 +71,9 @@ final class PhutilAmazonAuthAdapter extends PhutilOAuthAuthAdapter { try { return phutil_json_decode($body); } catch (PhutilJSONParserException $ex) { - throw new PhutilProxyException( + throw new Exception( pht('Expected valid JSON response from Amazon account data request.'), + 0, $ex); } } diff --git a/src/applications/auth/adapter/PhutilDisqusAuthAdapter.php b/src/applications/auth/adapter/PhutilDisqusAuthAdapter.php index b9a33b293a..5724053c2a 100644 --- a/src/applications/auth/adapter/PhutilDisqusAuthAdapter.php +++ b/src/applications/auth/adapter/PhutilDisqusAuthAdapter.php @@ -75,8 +75,9 @@ final class PhutilDisqusAuthAdapter extends PhutilOAuthAuthAdapter { $data = phutil_json_decode($body); return $data['response']; } catch (PhutilJSONParserException $ex) { - throw new PhutilProxyException( + throw new Exception( pht('Expected valid JSON response from Disqus account data request.'), + 0, $ex); } } diff --git a/src/applications/auth/adapter/PhutilFacebookAuthAdapter.php b/src/applications/auth/adapter/PhutilFacebookAuthAdapter.php index 9d087bbd37..59cb3bd4e7 100644 --- a/src/applications/auth/adapter/PhutilFacebookAuthAdapter.php +++ b/src/applications/auth/adapter/PhutilFacebookAuthAdapter.php @@ -80,8 +80,9 @@ final class PhutilFacebookAuthAdapter extends PhutilOAuthAuthAdapter { try { $data = phutil_json_decode($body); } catch (PhutilJSONParserException $ex) { - throw new PhutilProxyException( + throw new Exception( pht('Expected valid JSON response from Facebook account data request.'), + 0, $ex); } diff --git a/src/applications/auth/adapter/PhutilGitHubAuthAdapter.php b/src/applications/auth/adapter/PhutilGitHubAuthAdapter.php index 35dfc01ad9..f18dbb776b 100644 --- a/src/applications/auth/adapter/PhutilGitHubAuthAdapter.php +++ b/src/applications/auth/adapter/PhutilGitHubAuthAdapter.php @@ -68,8 +68,9 @@ final class PhutilGitHubAuthAdapter extends PhutilOAuthAuthAdapter { try { return phutil_json_decode($body); } catch (PhutilJSONParserException $ex) { - throw new PhutilProxyException( + throw new Exception( pht('Expected valid JSON response from GitHub account data request.'), + 0, $ex); } } diff --git a/src/applications/auth/adapter/PhutilGoogleAuthAdapter.php b/src/applications/auth/adapter/PhutilGoogleAuthAdapter.php index 54eaf3337c..57b2d7fd78 100644 --- a/src/applications/auth/adapter/PhutilGoogleAuthAdapter.php +++ b/src/applications/auth/adapter/PhutilGoogleAuthAdapter.php @@ -109,8 +109,9 @@ final class PhutilGoogleAuthAdapter extends PhutilOAuthAuthAdapter { try { $result = phutil_json_decode($body); } catch (PhutilJSONParserException $ex) { - throw new PhutilProxyException( + throw new Exception( pht('Expected valid JSON response from Google account data request.'), + 0, $ex); } diff --git a/src/applications/auth/future/PhabricatorDuoFuture.php b/src/applications/auth/future/PhabricatorDuoFuture.php index 1e70ec2a57..9393e06846 100644 --- a/src/applications/auth/future/PhabricatorDuoFuture.php +++ b/src/applications/auth/future/PhabricatorDuoFuture.php @@ -143,8 +143,9 @@ final class PhabricatorDuoFuture try { $data = phutil_json_decode($body); } catch (PhutilJSONParserException $ex) { - throw new PhutilProxyException( + throw new Exception( pht('Expected JSON response from Duo.'), + 0, $ex); } diff --git a/src/applications/auth/sshkey/PhabricatorAuthSSHPublicKey.php b/src/applications/auth/sshkey/PhabricatorAuthSSHPublicKey.php index 682cde0df6..454eb6c303 100644 --- a/src/applications/auth/sshkey/PhabricatorAuthSSHPublicKey.php +++ b/src/applications/auth/sshkey/PhabricatorAuthSSHPublicKey.php @@ -130,13 +130,14 @@ final class PhabricatorAuthSSHPublicKey extends Phobject { $tmp); } catch (CommandException $ex) { unset($tmp); - throw new PhutilProxyException( + throw new Exception( pht( 'Failed to convert public key into PKCS8 format. If you are '. 'developing on OSX, you may be able to use `%s` '. 'to work around this issue. %s', 'bin/auth cache-pkcs8', $ex->getMessage()), + 0, $ex); } unset($tmp); diff --git a/src/applications/conduit/controller/PhabricatorConduitAPIController.php b/src/applications/conduit/controller/PhabricatorConduitAPIController.php index 4a6108cfd5..c220d0ead4 100644 --- a/src/applications/conduit/controller/PhabricatorConduitAPIController.php +++ b/src/applications/conduit/controller/PhabricatorConduitAPIController.php @@ -689,10 +689,11 @@ final class PhabricatorConduitAPIController try { $params = phutil_json_decode($params_json); } catch (PhutilJSONParserException $ex) { - throw new PhutilProxyException( + throw new Exception( pht( "Invalid parameter information was passed to method '%s'.", $method), + 0, $ex); } diff --git a/src/applications/conduit/ssh/ConduitSSHWorkflow.php b/src/applications/conduit/ssh/ConduitSSHWorkflow.php index 0b4bd3cdef..ec46577754 100644 --- a/src/applications/conduit/ssh/ConduitSSHWorkflow.php +++ b/src/applications/conduit/ssh/ConduitSSHWorkflow.php @@ -30,8 +30,9 @@ final class ConduitSSHWorkflow extends PhabricatorSSHWorkflow { try { $raw_params = phutil_json_decode($json); } catch (PhutilJSONParserException $ex) { - throw new PhutilProxyException( + throw new Exception( pht('Invalid JSON input.'), + 0, $ex); } diff --git a/src/applications/differential/__tests__/DifferentialParseRenderTestCase.php b/src/applications/differential/__tests__/DifferentialParseRenderTestCase.php index 92b96c3051..6ac0be3ef7 100644 --- a/src/applications/differential/__tests__/DifferentialParseRenderTestCase.php +++ b/src/applications/differential/__tests__/DifferentialParseRenderTestCase.php @@ -24,8 +24,9 @@ final class DifferentialParseRenderTestCase extends PhabricatorTestCase { try { $options = phutil_json_decode($options); } catch (PhutilJSONParserException $ex) { - throw new PhutilProxyException( + throw new Exception( pht('Invalid options file: %s.', $opt_file), + 0, $ex); } } else { diff --git a/src/applications/diffusion/protocol/DiffusionRepositoryClusterEngine.php b/src/applications/diffusion/protocol/DiffusionRepositoryClusterEngine.php index 0b2f40c2d6..e3347094c6 100644 --- a/src/applications/diffusion/protocol/DiffusionRepositoryClusterEngine.php +++ b/src/applications/diffusion/protocol/DiffusionRepositoryClusterEngine.php @@ -189,12 +189,13 @@ final class DiffusionRepositoryClusterEngine extends Phobject { 'Acquired read lock immediately.')); } } catch (PhutilLockException $ex) { - throw new PhutilProxyException( + throw new Exception( pht( 'Failed to acquire read lock after waiting %s second(s). You '. 'may be able to retry later. (%s)', new PhutilNumber($lock_wait), $ex->getHint()), + 0, $ex); } @@ -379,12 +380,13 @@ final class DiffusionRepositoryClusterEngine extends Phobject { 'Acquired write lock immediately.')); } } catch (PhutilLockException $ex) { - throw new PhutilProxyException( + throw new Exception( pht( 'Failed to acquire write lock after waiting %s second(s). You '. 'may be able to retry later. (%s)', new PhutilNumber($lock_wait), $ex->getHint()), + 0, $ex); } diff --git a/src/applications/doorkeeper/bridge/DoorkeeperBridge.php b/src/applications/doorkeeper/bridge/DoorkeeperBridge.php index d25d48e857..1b1bf9199f 100644 --- a/src/applications/doorkeeper/bridge/DoorkeeperBridge.php +++ b/src/applications/doorkeeper/bridge/DoorkeeperBridge.php @@ -75,8 +75,9 @@ abstract class DoorkeeperBridge extends Phobject { ->withObjectKeys(array($ref->getObjectKey())) ->executeOne(); if (!$obj) { - throw new PhutilProxyException( + throw new Exception( pht('Failed to load external object after collision.'), + 0, $ex); } diff --git a/src/applications/drydock/worker/DrydockLeaseUpdateWorker.php b/src/applications/drydock/worker/DrydockLeaseUpdateWorker.php index 54a44660ec..b4066a847f 100644 --- a/src/applications/drydock/worker/DrydockLeaseUpdateWorker.php +++ b/src/applications/drydock/worker/DrydockLeaseUpdateWorker.php @@ -1066,10 +1066,11 @@ final class DrydockLeaseUpdateWorker extends DrydockWorker { case DrydockLeaseStatus::STATUS_BROKEN: case DrydockLeaseStatus::STATUS_RELEASED: case DrydockLeaseStatus::STATUS_DESTROYED: - throw new PhutilProxyException( + throw new Exception( pht( 'Unexpected failure while destroying lease ("%s").', $lease->getPHID()), + 0, $ex); } diff --git a/src/applications/drydock/worker/DrydockResourceUpdateWorker.php b/src/applications/drydock/worker/DrydockResourceUpdateWorker.php index 6316116c53..324639bd51 100644 --- a/src/applications/drydock/worker/DrydockResourceUpdateWorker.php +++ b/src/applications/drydock/worker/DrydockResourceUpdateWorker.php @@ -266,10 +266,11 @@ final class DrydockResourceUpdateWorker extends DrydockWorker { case DrydockResourceStatus::STATUS_DESTROYED: // If the resource was already broken, just throw a normal exception. // This will retry the task eventually. - throw new PhutilProxyException( + throw new Exception( pht( 'Unexpected failure while destroying resource ("%s").', $resource->getPHID()), + 0, $ex); } diff --git a/src/applications/drydock/worker/DrydockWorker.php b/src/applications/drydock/worker/DrydockWorker.php index 457624ec5d..0c5477b991 100644 --- a/src/applications/drydock/worker/DrydockWorker.php +++ b/src/applications/drydock/worker/DrydockWorker.php @@ -151,8 +151,8 @@ abstract class DrydockWorker extends PhabricatorWorker { } } - if ($ex instanceof PhutilProxyException) { - return $this->isTemporaryException($ex->getPreviousException()); + if ($ex->getPrevious()) { + return $this->isTemporaryException($ex->getPrevious()); } return false; diff --git a/src/applications/files/storage/PhabricatorFile.php b/src/applications/files/storage/PhabricatorFile.php index ce03655086..8d9616a21f 100644 --- a/src/applications/files/storage/PhabricatorFile.php +++ b/src/applications/files/storage/PhabricatorFile.php @@ -683,7 +683,7 @@ final class PhabricatorFile extends PhabricatorFileDAO } } catch (Exception $ex) { if ($redirects) { - throw new PhutilProxyException( + throw new Exception( pht( 'Failed to fetch remote URI "%s" after following %s redirect(s) '. '(%s): %s', @@ -691,6 +691,7 @@ final class PhabricatorFile extends PhabricatorFileDAO phutil_count($redirects), implode(' > ', array_keys($redirects)), $ex->getMessage()), + 0, $ex); } else { throw $ex; diff --git a/src/applications/herald/controller/HeraldRuleController.php b/src/applications/herald/controller/HeraldRuleController.php index be8c50f5ba..46a970a002 100644 --- a/src/applications/herald/controller/HeraldRuleController.php +++ b/src/applications/herald/controller/HeraldRuleController.php @@ -286,8 +286,9 @@ final class HeraldRuleController extends HeraldController { try { $data = phutil_json_decode($request->getStr('rule')); } catch (PhutilJSONParserException $ex) { - throw new PhutilProxyException( + throw new Exception( pht('Failed to decode rule data.'), + 0, $ex); } diff --git a/src/applications/metamta/adapter/PhabricatorMailMailgunAdapter.php b/src/applications/metamta/adapter/PhabricatorMailMailgunAdapter.php index 8223ee8102..6c2f103d8f 100644 --- a/src/applications/metamta/adapter/PhabricatorMailMailgunAdapter.php +++ b/src/applications/metamta/adapter/PhabricatorMailMailgunAdapter.php @@ -119,8 +119,9 @@ final class PhabricatorMailMailgunAdapter try { $response = phutil_json_decode($body); } catch (PhutilJSONParserException $ex) { - throw new PhutilProxyException( + throw new Exception( pht('Failed to JSON decode response.'), + 0, $ex); } diff --git a/src/applications/metamta/future/PhabricatorTwilioFuture.php b/src/applications/metamta/future/PhabricatorTwilioFuture.php index 8dc70329f8..5ff211c4eb 100644 --- a/src/applications/metamta/future/PhabricatorTwilioFuture.php +++ b/src/applications/metamta/future/PhabricatorTwilioFuture.php @@ -89,8 +89,9 @@ final class PhabricatorTwilioFuture extends FutureProxy { try { $data = phutil_json_decode($body); } catch (PhutilJSONParserException $ex) { - throw new PhutilProxyException( + throw new Exception( pht('Expected JSON response from Twilio.'), + 0, $ex); } diff --git a/src/applications/nuance/github/__tests__/NuanceGitHubRawEventTestCase.php b/src/applications/nuance/github/__tests__/NuanceGitHubRawEventTestCase.php index 4af9a440e2..7ecd44ed3b 100644 --- a/src/applications/nuance/github/__tests__/NuanceGitHubRawEventTestCase.php +++ b/src/applications/nuance/github/__tests__/NuanceGitHubRawEventTestCase.php @@ -95,10 +95,11 @@ final class NuanceGitHubRawEventTestCase $input = phutil_json_decode($input); $expect = phutil_json_decode($expect); } catch (Exception $ex) { - throw new PhutilProxyException( + throw new Exception( pht( 'Exception while decoding test data for test "%s".', $file), + 0, $ex); } diff --git a/src/applications/policy/controller/PhabricatorPolicyEditController.php b/src/applications/policy/controller/PhabricatorPolicyEditController.php index f211aa754d..c0a003a0c0 100644 --- a/src/applications/policy/controller/PhabricatorPolicyEditController.php +++ b/src/applications/policy/controller/PhabricatorPolicyEditController.php @@ -91,8 +91,9 @@ final class PhabricatorPolicyEditController try { $data = phutil_json_decode($data); } catch (PhutilJSONParserException $ex) { - throw new PhutilProxyException( + throw new Exception( pht('Failed to JSON decode rule data!'), + 0, $ex); } diff --git a/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php b/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php index 2da312eafb..101f22fa59 100644 --- a/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php +++ b/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php @@ -495,10 +495,11 @@ final class PhabricatorRepositoryPullLocalDaemon try { list($stdout, $stderr) = $future->resolvex(); } catch (Exception $ex) { - $proxy = new PhutilProxyException( + $proxy = new Exception( pht( 'Error while updating the "%s" repository.', $display_name), + 0, $ex); phlog($proxy); diff --git a/src/applications/repository/management/PhabricatorRepositoryManagementUpdateWorkflow.php b/src/applications/repository/management/PhabricatorRepositoryManagementUpdateWorkflow.php index 1b52a7c0e4..0e279a7dc8 100644 --- a/src/applications/repository/management/PhabricatorRepositoryManagementUpdateWorkflow.php +++ b/src/applications/repository/management/PhabricatorRepositoryManagementUpdateWorkflow.php @@ -126,10 +126,11 @@ final class PhabricatorRepositoryManagementUpdateWorkflow } catch (Exception $ex) { // TODO: We should report these into the UI properly, but for now just // complain. These errors are much less severe than pull errors. - $proxy = new PhutilProxyException( + $proxy = new Exception( pht( 'Error while pushing "%s" repository to mirrors.', $repository->getMonogram()), + 0, $ex); phlog($proxy); } diff --git a/src/applications/search/fulltextstorage/PhabricatorElasticFulltextStorageEngine.php b/src/applications/search/fulltextstorage/PhabricatorElasticFulltextStorageEngine.php index d774f4911c..a1a8959b67 100644 --- a/src/applications/search/fulltextstorage/PhabricatorElasticFulltextStorageEngine.php +++ b/src/applications/search/fulltextstorage/PhabricatorElasticFulltextStorageEngine.php @@ -533,8 +533,9 @@ class PhabricatorElasticFulltextStorageEngine return $data; } catch (PhutilJSONParserException $ex) { $host->didHealthCheck(false); - throw new PhutilProxyException( + throw new Exception( pht('Elasticsearch server returned invalid JSON!'), + 0, $ex); } diff --git a/src/applications/transactions/editengine/PhabricatorEditEngine.php b/src/applications/transactions/editengine/PhabricatorEditEngine.php index 6cdf4b39ca..1ba9dcfa5a 100644 --- a/src/applications/transactions/editengine/PhabricatorEditEngine.php +++ b/src/applications/transactions/editengine/PhabricatorEditEngine.php @@ -2295,11 +2295,12 @@ abstract class PhabricatorEditEngine $value = $type->getTransactionValueFromConduit($value); $xaction['value'] = $value; } catch (Exception $ex) { - throw new PhutilProxyException( + throw new Exception( pht( 'Exception when processing transaction of type "%s": %s', $xaction['type'], $ex->getMessage()), + 0, $ex); } diff --git a/src/applications/xhprof/controller/PhabricatorXHProfProfileController.php b/src/applications/xhprof/controller/PhabricatorXHProfProfileController.php index 16744a1ca0..a1c3ea0f9f 100644 --- a/src/applications/xhprof/controller/PhabricatorXHProfProfileController.php +++ b/src/applications/xhprof/controller/PhabricatorXHProfProfileController.php @@ -22,8 +22,9 @@ final class PhabricatorXHProfProfileController try { $data = phutil_json_decode($data); } catch (PhutilJSONParserException $ex) { - throw new PhutilProxyException( + throw new Exception( pht('Failed to unserialize XHProf profile!'), + 0, $ex); } diff --git a/src/infrastructure/daemon/workers/PhabricatorTaskmasterDaemon.php b/src/infrastructure/daemon/workers/PhabricatorTaskmasterDaemon.php index 12b06131d8..d69bdcb753 100644 --- a/src/infrastructure/daemon/workers/PhabricatorTaskmasterDaemon.php +++ b/src/infrastructure/daemon/workers/PhabricatorTaskmasterDaemon.php @@ -25,19 +25,21 @@ final class PhabricatorTaskmasterDaemon extends PhabricatorDaemon { if ($ex instanceof PhabricatorWorkerPermanentFailureException) { // NOTE: Make sure these reach the daemon log, even when not // running in verbose mode. See T12803 for discussion. - $log_exception = new PhutilProxyException( + $log_exception = new Exception( pht( 'Task "%s" encountered a permanent failure and was '. 'cancelled.', $id), + 0, $ex); phlog($log_exception); } else if ($ex instanceof PhabricatorWorkerYieldException) { $this->log(pht('Task %s yielded.', $id)); } else { $this->log(pht('Task %d failed!', $id)); - throw new PhutilProxyException( + throw new Exception( pht('Error while executing Task ID %d.', $id), + 0, $ex); } } else { diff --git a/src/infrastructure/daemon/workers/PhabricatorTriggerDaemon.php b/src/infrastructure/daemon/workers/PhabricatorTriggerDaemon.php index 736f17f81b..fd2c80e091 100644 --- a/src/infrastructure/daemon/workers/PhabricatorTriggerDaemon.php +++ b/src/infrastructure/daemon/workers/PhabricatorTriggerDaemon.php @@ -78,12 +78,13 @@ final class PhabricatorTriggerDaemon try { $lock->lock(5); } catch (PhutilLockException $ex) { - throw new PhutilProxyException( + throw new Exception( pht( 'Another process is holding the trigger lock. Usually, this '. 'means another copy of the trigger daemon is running elsewhere. '. 'Multiple processes are not permitted to update triggers '. 'simultaneously.'), + 0, $ex); } diff --git a/src/infrastructure/daemon/workers/PhabricatorWorker.php b/src/infrastructure/daemon/workers/PhabricatorWorker.php index fd215fc21f..7efe9abbbd 100644 --- a/src/infrastructure/daemon/workers/PhabricatorWorker.php +++ b/src/infrastructure/daemon/workers/PhabricatorWorker.php @@ -169,10 +169,11 @@ abstract class PhabricatorWorker extends Phobject { $task_result = PhabricatorWorkerArchiveTask::RESULT_SUCCESS; break; } catch (PhabricatorWorkerPermanentFailureException $ex) { - $proxy = new PhutilProxyException( + $proxy = new Exception( pht( 'In-process task ("%s") failed permanently.', $task_class), + 0, $ex); phlog($proxy); diff --git a/src/infrastructure/env/PhabricatorConfigLocalSource.php b/src/infrastructure/env/PhabricatorConfigLocalSource.php index fc1c83f812..6039521c72 100644 --- a/src/infrastructure/env/PhabricatorConfigLocalSource.php +++ b/src/infrastructure/env/PhabricatorConfigLocalSource.php @@ -29,23 +29,25 @@ final class PhabricatorConfigLocalSource extends PhabricatorConfigProxySource { try { $data = Filesystem::readFile($path); } catch (FilesystemException $ex) { - throw new PhutilProxyException( + throw new Exception( pht( 'Configuration file "%s" exists, but could not be read.', $path), + 0, $ex); } try { $result = phutil_json_decode($data); } catch (PhutilJSONParserException $ex) { - throw new PhutilProxyException( + throw new Exception( pht( 'Configuration file "%s" exists and is readable, but the content '. 'is not valid JSON. You may have edited this file manually and '. 'introduced a syntax error by mistake. Correct the file syntax '. 'to continue.', $path), + 0, $ex); } diff --git a/src/infrastructure/storage/lisk/LiskDAO.php b/src/infrastructure/storage/lisk/LiskDAO.php index e7bef6616b..3625cdbd9a 100644 --- a/src/infrastructure/storage/lisk/LiskDAO.php +++ b/src/infrastructure/storage/lisk/LiskDAO.php @@ -1095,12 +1095,13 @@ abstract class LiskDAO extends Phobject $data[$key] = qsprintf($conn, '%ns', $value); } } catch (AphrontParameterQueryException $parameter_exception) { - throw new PhutilProxyException( + throw new Exception( pht( "Unable to insert or update object of class %s, field '%s' ". "has a non-scalar value.", get_class($this), $key), + 0, $parameter_exception); } } diff --git a/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php b/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php index e2714bce03..4a7978690f 100644 --- a/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php +++ b/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php @@ -114,11 +114,12 @@ abstract class PhabricatorLiskDAO extends LiskDAO { // If we ended up here as the result of a failover, log the // exception. This is seriously bad news even if we are able // to recover from it. - $proxy_exception = new PhutilProxyException( + $proxy_exception = new Exception( pht( 'Failed to connect to master database ("%s"), failing over '. 'into read-only mode.', $database), + 0, $master_exception); phlog($proxy_exception); } diff --git a/src/infrastructure/storage/management/PhabricatorStorageManagementAPI.php b/src/infrastructure/storage/management/PhabricatorStorageManagementAPI.php index d9d16dba2e..abd84a2c4a 100644 --- a/src/infrastructure/storage/management/PhabricatorStorageManagementAPI.php +++ b/src/infrastructure/storage/management/PhabricatorStorageManagementAPI.php @@ -147,7 +147,7 @@ final class PhabricatorStorageManagementAPI extends Phobject { self::TABLE_STATUS); return ipull($applied, 'patch'); } catch (AphrontAccessDeniedQueryException $ex) { - throw new PhutilProxyException( + throw new Exception( pht( 'Failed while trying to read schema status: the database "%s" '. 'exists, but the current user ("%s") does not have permission to '. @@ -155,6 +155,7 @@ final class PhabricatorStorageManagementAPI extends Phobject { 'different user.', $this->getDatabaseName('meta_data'), $this->getUser()), + 0, $ex); } catch (AphrontQueryException $ex) { return null; @@ -284,7 +285,7 @@ final class PhabricatorStorageManagementAPI extends Phobject { // avoiding it since we're executing raw text files full of SQL. queryfx($conn, '%Z', $query); } catch (AphrontAccessDeniedQueryException $ex) { - throw new PhutilProxyException( + throw new Exception( pht( 'Unable to access a required database or table. This almost '. 'always means that the user you are connecting with ("%s") does '. @@ -292,6 +293,7 @@ final class PhabricatorStorageManagementAPI extends Phobject { 'use `bin/storage databases` to get a list of all databases '. 'permission is required on.', $this->getUser()), + 0, $ex); } } -- 2.51.2