caughtException() public method

This method is called when exception was caught in the application.
public caughtException ( Exception $e )
$e Exception
Esempio n. 1
0
 /**
  * @todo Description
  *
  * @param Exception $e
  */
 public function caughtException($e)
 {
     if ($e instanceof Exception_Migration) {
         try {
             // The mesage is for user. Let's display it nicely.
             $this->app->pathfinder->addLocation(array('public' => '.'))->setCDN('http://www.agiletoolkit.org/');
             /** @type Layout_Basic $l */
             $l = $this->app->add('Layout_Basic', null, null, array('layout/installer'));
             /** @type View $i */
             $i = $l->add('View');
             $i->addClass('atk-align-center');
             /** @type H1 $h */
             $h = $i->add('H1');
             $h->set($e->getMessage());
             if ($e instanceof Exception_Migration) {
                 /** @type P $p */
                 $p = $i->add('P');
                 $p->set('Hello and welcome to Agile Toolkit 4.3. ' . 'Your project may require some minor tweaks before you can use 4.3.');
             }
             /** @type Button $b */
             $b = $i->add('Button');
             $b->addClass('atk-swatch-green')->set(array('Migration Guide', 'icon' => 'book'))->link('https://github.com/atk4/docs/blob/master/articles/migration42/index.md');
             if ($this->app->template && $this->app->template->hasTag('Layout')) {
                 $t = $this->app->template;
             } else {
                 /** @type GiTemplate $t */
                 $t = $this->add('GiTemplate');
                 $t->loadTemplate('html');
             }
             $t->setHTML('Layout', $l->getHTML());
             $t->trySet('css', 'http://css.agiletoolkit.org/framework/css/installer.css');
             echo $t->render();
             exit;
         } catch (BaseException $e) {
             echo 'here';
             $this->app->add('Logger');
             return parent::caughtException($e);
         }
     }
     return parent::caughtException($e);
 }