Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save maciejzgadzaj/dbe6580ce416b0112044 to your computer and use it in GitHub Desktop.

Select an option

Save maciejzgadzaj/dbe6580ce416b0112044 to your computer and use it in GitHub Desktop.
diff --git i/index.php w/index.php
index 8b83199..2efe8c9 100644
--- i/index.php
+++ w/index.php
@@ -16,6 +16,29 @@
*/
define('DRUPAL_ROOT', getcwd());
-require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
-drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
-menu_execute_active_handler();
+
+try {
+ require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
+ drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
+ menu_execute_active_handler();
+} catch (Exception $e) {
+ // Hopefully we have devel installed?
+ if (module_exists('devel')) {
+ // Temporarily set all messages to be displayed.
+ $GLOBALS['conf']['error_level'] = 2;
+ // Temporarily mark current user as having access to devel information.
+ $drupal_static_fast['perm'] = &drupal_static('user_access');
+ $drupal_static_fast['perm'][$GLOBALS['user']->uid]['access devel information'] = 1;
+ // Print exception message and stack trace.
+ kpr($e->getMessage());
+ kpr($e->getFile() . ':' . $e->getLine());
+ kpr($e->getTrace());
+ }
+ // No devel, so we need to use crude var_dumps.
+ else {
+ var_dump($e->getMessage());
+ var_dump($e->getFile() . ':' . $e->getLine());
+ var_dump($e->getTrace());
+ }
+ die('Sorry.');
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment