Whoops only deals with Exceptions. Create a WhoopsErrorException based on the error details and handle that

@param array $record
430128
protected function writeError(array $record)
    {
        $exception = new WhoopsErrorException(
            $record['message'],
            $record['level'],
            0,
            $record['context']['file'],
            $record['context']['line']
        );

        $this->writeException($exception);
    }
115861
public function stream_handler_for_record( array $record ) {

		list( $filename, $file_permissions ) = $this->file_name_for_record( $record );

		if ( isset( $this->handlers[ $filename ] ) ) {
			return $this->handlers[ $filename ];
		}

		$this->close();

		$handler = new StreamHandler(
			$filename,
			$this->getLevel(),
			$this->getBubble(),
			$file_permissions,
			$this->locking
		);

		$this->handlers[ $filename ] = $handler;

		return $handler;
	}
135952
protected function validateRecord(array $record)
    {
        foreach ($this->validators as $name => $validator) {
            if (true !== $validator($record)) {
                throw CannotInsertRecord::triggerOnValidation($name, $record);
            }
        }
    }
1124776
protected function unsetImportedRelations(array & $record)
    {
        foreach ($record as $key => $value) {
            if (strpos($key, 'role_by_') !== false ||
                strpos($key, 'service_by_') !== false ||
                strpos($key, 'role_service_access_by_') !== false ||
                strpos($key, 'user_to_app_to_role_by_') !== false
            ) {
                if (empty($value) || is_array($value)) {
                    unset($record[$key]);
                }
            }
        }
    }
163658
protected function processChildRecord($record)
    {
        $id = (int)$record['uid'];
        $this->checkOptions($record);
        /* @var $recordContentObjectRenderer ContentObjectRenderer */
        $recordContentObjectRenderer = GeneralUtility::makeInstance(ContentObjectRenderer::class);
        $recordContentObjectRenderer->start($record, 'tt_content');
        $this->processedRecordVariables[$id] = ['data' => $record];
        if (
            (int)$this->options['recursive'] > 0 &&
            $record['CType'] === 'gridelements_pi1' &&
            !empty($record['tx_gridelements_backend_layout'])
        ) {
            $childProcessorConfiguration = $this->containerProcessorConfiguration;
            $childProcessorConfiguration['dataProcessing.']['0.'] = $this->processorConfiguration;
            $childProcessorConfiguration['dataProcessing.']['0.']['recursive'] = (int)$this->options['recursive'] - 1;
            $childProcessorConfiguration['dataProcessing.']['0'] = 'GridElementsTeam\Gridelements\DataProcessing\GridChildrenProcessor';
            $this->processedRecordVariables[$id] = $this->contentDataProcessor->process(
                $recordContentObjectRenderer,
                $childProcessorConfiguration,
                $this->processedRecordVariables[$id]
            );
        } else {
            $this->processedRecordVariables[$id] = $this->contentDataProcessor->process(
                $recordContentObjectRenderer,
                $this->containerProcessorConfiguration,
                $this->processedRecordVariables[$id]
            );
        }
    }
135916
protected function write(array $record)
    {
        \assert('array_key_exists(\'formatted\', $record)');
        $this->notification
            ->setTitle(sprintf('[%s] %s', Logger::getLevelName($this->level), $this->name))
            ->setBody($record['formatted']);
        $this->notifier && $this->notifier->send($this->notification);
    }
1053576
protected function renderExceptionWithWhoops(Exception $e)
    {
        return tap(new Whoops(), function ($whoops) {
            $whoops->pushHandler($this->whoopsHandler());
            $whoops->writeToOutput(false);
            $whoops->allowQuit(false);
        })->handleException($e);
    }
479811
protected function write(array $record): void
    {
        try
        {
            $this->streamWriter->write((string) $record['formatted']);
        }
        // @codeCoverageIgnoreStart
        catch (\Throwable $throwable)
        {
            /** Not interest */
        }
        // @codeCoverageIgnoreEnd
    }
1081342
protected function set_rules($record) {
        $comp = $record->createdcomp;
        if ($record->ruletype) {
            $class = $record->ruletype;
            if (class_exists($class)) {
                $oldruleconfig = $record->ruleconfig;
                if ($oldruleconfig == "null") {
                    $oldruleconfig = null;
                }
                $newruleconfig = $class::migrate_config($oldruleconfig, $this->mappings);
                $comp->set('ruleconfig', $newruleconfig);
                $comp->set('ruletype', $class);
                $comp->set('ruleoutcome', $record->ruleoutcome);
                $comp->update();
            }
        }
        foreach ($record->children as $child) {
            $this->set_rules($child);
        }
    }
226189
public function log(\Imi\Log\Record $record)
    {
        if(in_array($record->getLevel(), $this->levels))
        {
            $this->records[] = $record;
            $this->trySave();
        }
    }
1015028
public function registerErrorHandler()
    {
        $whoops = new \Whoops\Run();
        $configuration = $this->getConfiguration();

        if (isset($configuration['debug']) && $configuration['debug']) {
            $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler());
        } else {
            $whoops->pushHandler(new \Whoops\Handler\CallbackHandler(function ($exception) {
                $this->logger->error($exception->getMessage(), compact('exception'));

                $request = $this->container->get('request');
                $response = $this->container->get('response');
                $view = $this->container->get('view');
                $errorInfo = ['message' => $exception->getMessage()];

                if (is_a($exception, HttpException::class)) {
                    $errorInfo['code'] = $exception->getCode();
                } else {
                    $errorInfo['code'] = 500;
                }

                $headerAccept = $request->getHeader('Accept');
                if (in_array('application/json', $headerAccept)) {
                    $response = $response->withStatus($errorInfo['code']);
                    $response->getBody()->write(json_encode($errorInfo));

                    $response = $response->withHeader('Content-Type', 'application/json');
                } else {
                    $response = $view->render($response, 'error', $errorInfo);
                }

                $this->emitResponse($response);

                return \Whoops\Handler\Handler::DONE;
            }));
        }

        $whoops->register();
    }
605630
public function isHandling(array $record)
    {
        if (empty($this->levels)) {
            return true;
        }

        return in_array($record['level'], $this->levels);
    }
807905
protected function cleanup($record)
    {
        // Translate Throwable (Exception || Error) object into simple array
        if ($this->convertThrowable && $record instanceof Throwable) {
            $record = [
                'message'  => $record->getMessage(),
                'line'     => $record->getLine(),
                'file'     => $record->getFile(),
                'class'    => get_class($record),
                'code'     => $record->getCode(),
                'trace'    => $record->getTrace(),
                'previous' => $record->getPrevious(),
            ];
        }

        // Translate Traversable object into simple array
        if ($this->convertTraversable && $record instanceof Traversable) {
            $record = (array)$record;
        }

        // Traverse over array
        if (is_array($record)) {
            $clean = [];
            foreach ($record as $key => $value) {
                // Remove elements with null value
                if ($this->removeNull && is_null($value)) {
                    unset($clean[$key]);
                    continue;
                }
                $clean[$key] = $this->cleanup($value);
            }

            return $clean;
        }

        // Strip unwanted strings from simple scalar values
        if ($this->stripTags && is_scalar($record)) {
            return str_replace($this->stripTags, '', $record);
        }

        // Return original value if not scalar or array
        return $record;
    }
403509
protected function write(array $record)
    {
        if (null === $this->url || '' === $this->url) {
            throw new \LogicException('Missing stream url, the stream can not be opened. This may be caused by a premature call to close().');
        }

        $writeSuccess = false;
        do {
            if (!(function_exists('getInstance') && is_object(getInstance()->server))) {
                break;
            }

            if (!(property_exists(getInstance()->server, 'taskworker') && (getInstance()->server->taskworker === false))) {
                break;
            }

            if (swoole_async_writefile($this->url, (string)$record['formatted'], null, FILE_APPEND)) {
                $writeSuccess = true;
                break;
            }

            break;
        } while (0);

        if (!$writeSuccess) {
            file_put_contents($this->url, (string)$record['formatted'], FILE_APPEND);
        }
    }
1160197
private function processDoctrineLogRecord(array $record)
    {
        if (!isset($record['context']) || empty($record['context'])) {
            return $record;
        }

        $isDatabaseQueryContext = $this->arrayContainsOnlyNumericKeys($record['context']);
        if ($isDatabaseQueryContext) {
            $record['context'] = array('query params' => $record['context']);
        }

        return $record;
    }
672650
public function tryAnException()
    {
        try {
            $iterator = $this->endpoint->listRecords('foobardoesnotexist');
            $iterator->current();
        } catch (\Phpoaipmh\Exception\OaipmhException $e) {
            throw $e;
        }
    }
359840
public function setHandler(Handler $handler)
    {
        $this->whoops->popHandler();
        $this->handler = $handler;
        $this->whoops->pushHandler($this->handler);
    }