protected function setErrorHandler($class, string $methodName = 'handle'): Environment
    {
        if (!is_string($class) && !is_object($class)) {
            throw new \InvalidArgumentException(
                    'Given class must be a class name or a class instance.'
            );
        }

        $this->errorHandler = ['class' => $class, 'method' => $methodName];
        return $this;
    }