]> khamidou — GitHub mirrors - arcanist.git/commitdiff
If a `PhutilProxyException` is thrown by Arcanist, print all error messages.
authorJoshua Spence <josh@joshuaspence.com>
Mon, 23 Jun 2014 23:24:00 +0000 (09:24 +1000)
committerJoshua Spence <josh@joshuaspence.com>
Mon, 23 Jun 2014 23:24:00 +0000 (09:24 +1000)
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

index 1aca2d59ff5aab43f4e7db0c1c6972f11fc3464b..f7389d3b694f7dbe1a39e83b6515ff6a752ceafb 100755 (executable)
@@ -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);