Ejemplo n.º 1
0
 /**
  * Handle the shutdown of the system, recording any fatal errors.
  */
 public function handler()
 {
     $err = error_get_last();
     if (!isset($err['type']) || !in_array($err['type'], [E_USER_ERROR, E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING])) {
         return;
     }
     $this->viewMessageBox->setTitle('Fatal Error');
     $this->viewMessageBox->addContent(['p', ['class' => 'Description'], 'This is an error that we were unable to handle.  Please tell us any information that could help us ' . 'avoid this error in the future.  Useful information such as the date, time and what you were doing ' . 'when the error occurred should help us fix this.']);
     if (!empty($this->email)) {
         $this->viewMessageBox->addContent(['div', ['class' => 'Contact'], 'Contact: ' . $this->email]);
     }
     if ($this->showError) {
         $this->viewError->set($err);
         $this->viewMessageBox->addContent($this->viewError->get());
     }
     $this->writer->write($this->viewMessageBox->get());
     $this->response->setStatus(500);
     $this->response->setBody((string) $this->writer);
     $this->response->send();
 }
Ejemplo n.º 2
0
 /**
  * Unknown errors can still be dealt with.
  */
 public function testUnknownError()
 {
     $object = new Error('WHO KNOWS');
     $object->set(['file' => 'F', 'line' => 2, 'message' => 'BLAH', 'type' => -1]);
     $this->assertSame(['div', ['class' => 'error'], [['div', ['class' => 'details'], [['span', ['class' => 'type'], 'WHO KNOWS'], ['span', ['class' => 'file'], 'F'], ['span', ['class' => 'line'], 2]]], ['p', ['class' => 'message'], 'BLAH']]], $object->get());
 }