/** * Writes an error message to stderr * * @param \Exception $e * @return Console */ public function writeException(\Exception $e) { if ($this->verboseException) { $text = sprintf("[%s]\n%s\nIn %s at line %s\n%s", get_class($e), $e->getMessage(), $e->getFile(), $e->getLine(), $e->getTraceAsString()); } else { $text = sprintf("\n[%s]\n%s\n", get_class($e), $e->getMessage()); } $box = new Widgets\Box($this->textWriter, $text, ''); $out = Colors::colorizeLines($box, Colors::WHITE, Colors::RED); $out = TextFormater::apply($out, array('indent' => 2)); $this->textWriter->writeln($out); return $this; }