Пример #1
0
 protected function handleException(\Exception $exception)
 {
     // set error template
     $class = str_replace('\\', '/', get_class($this));
     if (strpos($class, '/Application/') !== false) {
         $path = PSX_PATH_LIBRARY . '/' . strstr($class, '/Application/', true) . '/Resource';
         $file = substr(strstr($class, 'Application'), 12);
         $file = $this->underscore($file) . '.html';
         if (!is_file($path . '/' . $file)) {
             $this->template->set($this->getFallbackTemplate());
         }
     } else {
         $this->template->set($this->getFallbackTemplate());
     }
     // build message
     $record = $this->exceptionConverter->convert($exception);
     $this->setBody($record);
 }
Пример #2
0
 public function testConvertLiveDisplayException()
 {
     $converter = new Converter(false);
     try {
         throw new DisplayException('foo');
     } catch (DisplayException $e) {
         $record = $converter->convert($e);
         $this->assertEquals(false, $record->getSuccess());
         $this->assertEquals('Internal Server Error', $record->getTitle());
         $this->assertEquals('foo', $record->getMessage());
         $this->assertEquals('', $record->getTrace());
         $this->assertEquals('', $record->getContext());
     }
 }