src/ExceptionHandler.php
public static function exception($Throwable){

		// Dump all output buffers

		while(@ob_end_clean());

		try{

			// Command-line interface

			if(PHP_SAPI == 'cli'){

				$message = BaseException::displayConsoleException($Throwable);
				if(@fwrite(STDERR, $message) === false) echo $message;
			}

			// HTTP/1.1

			else{

				@header("HTTP/1.1 500 Internal Server Error");
				@header('Content-Type: text/html');

				echo BaseException::displayException($Throwable);
			}
		}

			// Exception while displaying the exception

		catch(\Throwable $e){

			$class = get_class($e);
			$message = $e->getMessage();

			echo "Uncaught $class inside exception-handler: \"$message\"";
		}

		exit(1);
	}
public static function exception($Throwable){

		// Dump all output buffers

		while(@ob_end_clean());

		try{

			// Command-line interface

			if(PHP_SAPI == 'cli'){

				$message = BaseException::displayConsoleException($Throwable);
				if(@fwrite(STDERR, $message) === false) echo $message;
			}

			// HTTP/1.1

			else{

				@header("HTTP/1.1 500 Internal Server Error");
				@header('Content-Type: text/html');

				echo BaseException::displayException($Throwable);
			}
		}

			// Exception while displaying the exception

		catch(\Throwable $e){

			$class = get_class($e);
			$message = $e->getMessage();

			echo "Uncaught $class inside exception-handler: \"$message\"";
		}

		exit(1);
	}
Properly display all uncaught exceptions.

<p>Automatically switches between a plain-text and HTML exception
depending upon the SAPI.</p>

@param $Throwable
@return void
@see BaseException::displayException()
@see BaseException::displayConsoleException()