Allow to pass an error object or exception to Horde_Cli#fatal().
authorJan Schneider <jan@horde.org>
Wed, 11 Aug 2010 16:10:58 +0000 (18:10 +0200)
committerJan Schneider <jan@horde.org>
Wed, 11 Aug 2010 16:10:58 +0000 (18:10 +0200)
framework/Cli/lib/Horde/Cli.php

index 3837e47..f37d7ce 100644 (file)
@@ -300,10 +300,14 @@ class Horde_Cli
     /**
      * Displays a fatal error message.
      *
-     * @param string $error  The error text to display.
+     * @param mixed $error  The error text to display, an exception or an
+     *                      object with a getMessage() method.
      */
     public function fatal($error)
     {
+        if (is_object($error) && method_exists($error, 'getMessage')) {
+            $error = $error->getMessage();
+        }
         $this->writeln($this->red('===================='));
         $this->writeln();
         $this->writeln($this->red(_("Fatal Error:")));