]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Improve 'arc' error message when failing to load a library
authorjungejason <jungejason@fb.com>
Mon, 4 Apr 2011 23:26:46 +0000 (16:26 -0700)
committerjungejason <jungejason@fb.com>
Mon, 4 Apr 2011 23:44:09 +0000 (16:44 -0700)
Summary:
display better message about the .arcconfig. The message will
be something like this now:
  Usage Exception: Failed to load library "phabricator" at location
  "srcaaaaa/". Please check the "phutil_libraries" setting in your
  .arcconfig file. Refer to page
  http://phabricator.com/docs/arcanist/article/Setting_Up_.arcconfig.html
  for more info.

Test Plan:
modify the .arcconfig file to test it. Also make sure it
works for correct settings.

Reviewed By: epriestley
Reviewers: epriestley
CC: jungejason, epriestley
Differential Revision: 99

scripts/arcanist.php

index 67d585b6e31d044e8c90f3ddbf7718197d2efc7d..e70f23bac3bd91346cea564e93708ec8ed9349da 100755 (executable)
@@ -89,7 +89,18 @@ try {
       if (Filesystem::pathExists($resolved_location)) {
         $location = $resolved_location;
       }
-      phutil_load_library($location);
+      try {
+        phutil_load_library($location);
+      } catch (PhutilBootloaderException $ex) {
+        $error_msg = sprintf(
+          'Failed to load library "%s" at location "%s". Please check the '.
+          '"phutil_libraries" setting in your .arcconfig file. Refer to page '.
+          'http://phabricator.com/docs/arcanist/article/'.
+          'Setting_Up_.arcconfig.html for more info.',
+          $name,
+          $location);
+        throw new ArcanistUsageException($error_msg);
+      }
     }
   }