Set the proper Error Handler based on the Output of the page

@param Handler $handler
359840
public function setHandler(Handler $handler)
    {
        $this->whoops->popHandler();
        $this->handler = $handler;
        $this->whoops->pushHandler($this->handler);
    }
231295
protected function setGenericMessageHandler(GenericMessageHandler $handler): void
	{
		$handler->setBot($this);
		$this->genericMessageHandler = $handler;
	}
407051
protected function registerErrorHandler()
    {
        Event::listen('exception.beforeRender', function ($exception, $httpCode, $request) {
            $handler = new ErrorHandler;
            return $handler->handleException($exception);
        });
    }
741429
@Override
    public void setErrorHandler(ErrorHandler handler) {
        if (errorHandlerLocked) {
            return;
        }
        if (handler == null) {
            handler = base;
        }
        this.errorHandler = handler;
    }
533937
public function setErrorHandler(callable $errorHandler)
    {
        $this->raiseThrowables();
        $errorHandler = $this->normalizeErrorHandler($errorHandler);
        $this->errorHandler = $errorHandler;
    }
290471
public static function sendError($handle, $errorMessage) {
        $buffer = self::_parseError($errorMessage);
        return self::_writeToServer($handle, $buffer);
    }
444653
private function load_handler_as_file($handler) {
	$path = $this->find_handler_path($handler);
	require_once $path;
	
	$class_name = str_replace('/', '\\', $handler);
	if ($this->auto_instantiation && is_callable($class_name)) {
		new $class_name($this->url, $this->method, $this->arguments);
	}
}
434973
public function handle_exception($exception) {
		$quit = false;
		$output = '';

		foreach ($this->handlers as $handler) {
			if ($handler->can_run()) {
				$handler->set_exception($exception);

				// The output is a concatenation of all output returned by the
				// handlers. Ideally, we only have one handler sending output.
				$output .= $handler->handle();

				if ($handler->requests_quit() === true) {
					$quit = $handler->requests_quit();
				}

				// If the handler claims it should be the last handler, break out of the loop
				if ($handler->is_last() === true) {
					break;
				}
			}
		}

		if (trim($output) !== '') {
			echo $output;
		}

		if ($quit === true) {
			// Since we are exiting after an error, don't exit with 0
			exit(1);
		}
	}
1010120
protected function handlesException(Closure $handler, $exception)
	{
		$reflection = new ReflectionFunction($handler);

		return $reflection->getNumberOfParameters() == 0 || $this->hints($reflection, $exception);
	}
1130080
protected function cleanup_error_handler()
    {
        restore_error_handler();

        if ($this->last_error !== null) {
            throw new \ErrorException(
                $this->last_error['errstr'],
                0,
                $this->last_error['errno'],
                $this->last_error['errfile'],
                $this->last_error['errline']
            );
        }
    }
119292
public function setErrorHandler(callable $handler, $types = 'use-php-defaults')
    {
        // Workaround for PHP 5.5
        if ($types === 'use-php-defaults') {
            $types = E_ALL | E_STRICT;
        }
        #set_error_handler([$this, 'onError'], error_reporting());
        return set_error_handler($handler, $types);
    }
1291472
private function registerErrorHandler(): void
    {
        $whoops = new Run();
        $whoops->pushHandler(new PrettyPageHandler());
        $whoops->register();

        $this->errorHandler = $whoops;
    }
332188
public function setHandler($handler, $handlerMethod = null) : void
    {
        if (!is_callable($handler) && is_null($handlerMethod)) {
            throw new \InvalidArgumentException(
                'In case the $handler is not a callable, $handlerMethod must specify a method to be called'
            );
        }
        $this->handler = $handler;
        $this->handlerMethod = $handlerMethod;
    }
1036455
function setError( $connection = false )
    {
        if ( $this->IsConnected )
        {
            if ( $connection === false )
                $connection = $this->DBConnection;

            if ( $connection instanceof MySQLi )
            {
                $this->ErrorMessage = mysqli_error( $connection );
                $this->ErrorNumber = mysqli_errno( $connection );
            }
        }
        else
        {
            $this->ErrorMessage = mysqli_connect_error();
            $this->ErrorNumber = mysqli_connect_errno();
        }
    }
559922
protected function initErrorHandler()
    {
        if (!isset($this->chainedErrorHandler)) {
            $this->chainedErrorHandler = $this->setErrorHandler([$this, 'handleError']) ?: false;
        }
    }
395802
protected function registerErrorHandler()
    {
        $instance = $this;
        $this->previousErrorHandler = set_error_handler(
            function ($errno, $errstr, $errfile, $errline) use ($instance) {
                $message = sprintf('%d: %s - File: %s - Line: %d', $errno, $errstr, $errfile, $errline);
                throw new \Exception($message, $errno);
            }
        );
    }
964013
public static function set(): ?callable
    {
        if (! static::$handler) {
            static::$handler = function ($severity, $message, $file, $line): void {
                throw new \ErrorException($message, 0, $severity, $file, $line);
            };
        }

        return set_error_handler(static::$handler, E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED);
    }