/** * Tests */ public function testShouldDisplay404Error() { $request = new NeechyRequest(); $page = Page::find_by_title('NeechyPage'); try { throw new NeechyWebServiceError('Testing 404 Error', 404); } catch (NeechyError $e) { $handler = new ErrorHandler($request); $response = $handler->handle_error($e); } $this->assertEquals(404, $response->status); $this->assertContains($e->getMessage(), $response->body); $this->assertContains('Testing 404 Error', $response->body); }
public function serve() { try { NeechySecurity::start_session(); NeechySecurity::prevent_csrf(); $this->request = NeechyRequest::load(); $this->validate_environment(); $handler = $this->load_handler(); $response = $handler->handle(); } catch (NeechyError $e) { $handler = new ErrorHandler($this->request); $response = $handler->handle_error($e); } $response->send_headers(); $response->render(); }
function check_for_fatal() { global $error_reporting_level; $error = error_get_last(); $fatal_reporting_level = E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR; if ($error["type"] & $error_reporting_level & $fatal_reporting_level) { ErrorHandler::handle_error($error["type"], $error["message"], $error["file"], $error["line"], ''); } }