Error[$errno]: $errstr in $errfile at line $errline"; } private static function exception($exception) { self::$error_messages[] = "Uncaught Exception: " . $exception; } private static function shutdown(callable $callback) { if (!self::$error_messages) { return; } // remove current output to be replaced by error page ob_end_clean(); http_response_code(500); header_remove(); $callback(self::$error_messages); } }