From 69cd86fa4f3e8c01ed4a242f28d3343699417762 Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Tue, 24 Jun 2014 09:24:00 +1000 Subject: [PATCH] If a `PhutilProxyException` is thrown by Arcanist, print all error messages. Summary: `PhutilProxyException` provides the capability to nest exceptions. However, if we throw a `PhutilProxyException` then we currently only display the error message from the top-most exception. Instead, we should print all of the nested exception messages. Test Plan: Faked an error, saw multiple lines of exception messages. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: epriestley, Korvin Differential Revision: https://secure.phabricator.com/D9697 --- scripts/arcanist.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/scripts/arcanist.php b/scripts/arcanist.php index 1aca2d59..f7389d3b 100755 --- a/scripts/arcanist.php +++ b/scripts/arcanist.php @@ -365,10 +365,19 @@ try { } if (!$is_usage) { - echo phutil_console_format( - "**Exception**\n%s\n%s\n", - $ex->getMessage(), - '(Run with --trace for a full exception trace.)'); + echo phutil_console_format("**Exception**\n"); + + while ($ex) { + echo $ex->getMessage()."\n"; + + if ($ex instanceof PhutilProxyException) { + $ex = $ex->getPreviousException(); + } else { + $ex = null; + } + } + + echo "(Run with --trace for a full exception trace.)\n"; } exit(1);