From 7b997359466f08dcee82f9942534b7a1eb31d18c Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 11 Dec 2015 16:48:22 -0800 Subject: [PATCH] Throw CommandException instead of Exception after `git fetch` failure in repository updates Summary: Fixes T9966. In this unusual, difficult-to-reach case, we throw `Exception` (which has no censoring) instead of `CommandException` (which has censoring). Throw `CommandException` instead. Test Plan: - Hacked up a bunch of stuff in order to hit this: disabled origin validation, origin correction, and pointed repository at a bad domain. - Verified message is now censored correctly. {F1022217} Reviewers: chad Reviewed By: chad Maniphest Tasks: T9966 Differential Revision: https://secure.phabricator.com/D14745 --- .../engine/PhabricatorRepositoryPullEngine.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php b/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php index 41f6dbfa0f..299310be27 100644 --- a/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php +++ b/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php @@ -334,12 +334,12 @@ final class PhabricatorRepositoryPullEngine $remote_uri); } } else if ($err) { - throw new Exception( - pht( - "git fetch failed with error #%d:\nstdout:%s\n\nstderr:%s\n", - $err, - $stdout, - $stderr)); + throw new CommandException( + pht('Failed to fetch changes!'), + $future->getCommand(), + $err, + $stdout, + $stderr); } else { $retry = false; }