Skip to content

Commit

Permalink
!!![TASK] Introduce specific EXT:solr exceptions
Browse files Browse the repository at this point in the history
Existing exceptions are now based on the recently introduced
generic EXT:solr exception.

Additionally based on the new generic EXT:solr exception a further
exception is introduced, allowing more targeted handling of exceptions:
InvalidIndexQueueInitizalizationPostProcessorException

This is a breaking change as the base excepion changed and the new
exception is no longer based on \UnexpectedValueException.

Resolves: #3763
  • Loading branch information
dkd-friedrich authored and dkd-kaehm committed Sep 15, 2023
1 parent c2e84f9 commit 1ed1c4a
Show file tree
Hide file tree
Showing 51 changed files with 103 additions and 52 deletions.
2 changes: 1 addition & 1 deletion Classes/Access/RootlineElementFormatException.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

namespace ApacheSolrForTypo3\Solr\Access;

use InvalidArgumentException;
use ApacheSolrForTypo3\Solr\Exception\InvalidArgumentException;

/**
* Signals a wrong format for the access definition of a page or the content.
Expand Down
2 changes: 1 addition & 1 deletion Classes/ConnectionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
use ApacheSolrForTypo3\Solr\Domain\Site\Exception\UnexpectedTYPO3SiteInitializationException;
use ApacheSolrForTypo3\Solr\Domain\Site\Site;
use ApacheSolrForTypo3\Solr\Domain\Site\SiteRepository;
use ApacheSolrForTypo3\Solr\Exception\InvalidArgumentException;
use ApacheSolrForTypo3\Solr\System\Records\Pages\PagesRepository as PagesRepositoryAtExtSolr;
use ApacheSolrForTypo3\Solr\System\Solr\Node;
use ApacheSolrForTypo3\Solr\System\Solr\SolrConnection;
use ApacheSolrForTypo3\Solr\System\Util\SiteUtility;
use Doctrine\DBAL\Exception as DBALException;
use InvalidArgumentException;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Site\Entity\Site as Typo3Site;
use TYPO3\CMS\Core\Utility\GeneralUtility;
Expand Down
2 changes: 1 addition & 1 deletion Classes/ContentObject/Classification.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

use ApacheSolrForTypo3\Solr\Domain\Index\Classification\Classification as ClassificationItem;
use ApacheSolrForTypo3\Solr\Domain\Index\Classification\ClassificationService;
use InvalidArgumentException;
use ApacheSolrForTypo3\Solr\Exception\InvalidArgumentException;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Frontend\ContentObject\AbstractContentObject;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
use ApacheSolrForTypo3\Solr\Domain\Site\Exception\UnexpectedTYPO3SiteInitializationException;
use ApacheSolrForTypo3\Solr\Domain\Site\Site;
use ApacheSolrForTypo3\Solr\Domain\Site\SiteRepository;
use ApacheSolrForTypo3\Solr\Exception\InvalidArgumentException;
use ApacheSolrForTypo3\Solr\IndexQueue\QueueInterface;
use ApacheSolrForTypo3\Solr\System\Mvc\Backend\Service\ModuleDataStorageService;
use ApacheSolrForTypo3\Solr\System\Solr\SolrConnection as SolrCoreConnection;
use Doctrine\DBAL\Exception as DBALException;
use InvalidArgumentException;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Backend\Template\Components\Menu\Menu;
use TYPO3\CMS\Backend\Template\ModuleTemplate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@

use ApacheSolrForTypo3\Solr\ConnectionManager;
use ApacheSolrForTypo3\Solr\Domain\Site\Exception\UnexpectedTYPO3SiteInitializationException;
use ApacheSolrForTypo3\Solr\Exception\InvalidArgumentException;
use ApacheSolrForTypo3\Solr\GarbageCollectorPostProcessor;
use ApacheSolrForTypo3\Solr\IndexQueue\Queue;
use ApacheSolrForTypo3\Solr\IndexQueue\QueueInterface;
use ApacheSolrForTypo3\Solr\System\Logging\SolrLogManager;
use Doctrine\DBAL\Exception as DBALException;
use InvalidArgumentException;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use UnexpectedValueException;

Expand Down
3 changes: 2 additions & 1 deletion Classes/Domain/Index/Queue/QueueInitializationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use ApacheSolrForTypo3\Solr\Domain\Site\Site;
use ApacheSolrForTypo3\Solr\Event\IndexQueue\AfterIndexQueueHasBeenInitializedEvent;
use ApacheSolrForTypo3\Solr\IndexQueue\Initializer\AbstractInitializer;
use ApacheSolrForTypo3\Solr\IndexQueue\QueueInitializationServiceAwareInterface;
use ApacheSolrForTypo3\Solr\IndexQueue\QueueInterface;
use Doctrine\DBAL\ConnectionException;
use Doctrine\DBAL\Exception as DBALException;
Expand All @@ -42,7 +43,7 @@ public function __construct(EventDispatcherInterface $eventDispatcher = null)
{
$this->eventDispatcher = $eventDispatcher ?? GeneralUtility::makeInstance(EventDispatcherInterface::class);
}

public function setClearQueueOnInitialization(bool $clearQueueOnInitialization): void
{
$this->clearQueueOnInitialization = $clearQueueOnInitialization;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
use ApacheSolrForTypo3\Solr\Domain\Index\Queue\UpdateHandler\EventListener\Events\ProcessingFinishedEventInterface;
use ApacheSolrForTypo3\Solr\Domain\Index\Queue\UpdateHandler\Events\DataUpdateEventInterface;
use ApacheSolrForTypo3\Solr\Domain\Index\Queue\UpdateHandler\GarbageHandler;
use ApacheSolrForTypo3\Solr\Exception\InvalidArgumentException;
use ApacheSolrForTypo3\Solr\System\Configuration\ExtensionConfiguration;
use InvalidArgumentException;
use Psr\EventDispatcher\EventDispatcherInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

namespace ApacheSolrForTypo3\Solr\Domain\Search\LastSearches;

use ApacheSolrForTypo3\Solr\Exception\InvalidArgumentException;
use ApacheSolrForTypo3\Solr\System\Records\AbstractRepository;
use Doctrine\DBAL\Exception as DBALException;
use InvalidArgumentException;

use function json_encode;

Expand Down
2 changes: 1 addition & 1 deletion Classes/Domain/Search/Query/ParameterBuilder/Operator.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

namespace ApacheSolrForTypo3\Solr\Domain\Search\Query\ParameterBuilder;

use InvalidArgumentException;
use ApacheSolrForTypo3\Solr\Exception\InvalidArgumentException;

/**
* The Operator ParameterProvider is responsible to build the solr query parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

namespace ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Facets;

use Exception;
use ApacheSolrForTypo3\Solr\Exception;

class InvalidFacetPackageException extends Exception
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

namespace ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Facets;

use Exception;
use ApacheSolrForTypo3\Solr\Exception;

class InvalidFacetParserException extends Exception
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

namespace ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Facets;

use Exception;
use ApacheSolrForTypo3\Solr\Exception;

class InvalidQueryBuilderException extends Exception
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

namespace ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Facets;

use Exception;
use ApacheSolrForTypo3\Solr\Exception;

class InvalidUrlDecoderException extends Exception
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
namespace ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Facets\RangeBased\NumericRange;

use ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Facets\FacetUrlDecoderInterface;
use InvalidArgumentException;
use ApacheSolrForTypo3\Solr\Exception\InvalidArgumentException;

/**
* Parser to build Solr range queries from tx_solr[filter]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

namespace ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Facets;

use InvalidArgumentException;
use ApacheSolrForTypo3\Solr\Exception\InvalidArgumentException;
use TYPO3\CMS\Core\Utility\GeneralUtility;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
namespace ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Result\Parser;

use ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\SearchResultSet;
use InvalidArgumentException;
use ApacheSolrForTypo3\Solr\Exception\InvalidArgumentException;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

namespace ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Result;

use ApacheSolrForTypo3\Solr\Exception\InvalidArgumentException;
use ApacheSolrForTypo3\Solr\System\Solr\Document\Document;
use InvalidArgumentException;
use TYPO3\CMS\Core\Utility\GeneralUtility;

/**
Expand Down
2 changes: 1 addition & 1 deletion Classes/Domain/Search/ResultSet/Sorting/Sorting.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
namespace ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Sorting;

use ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\SearchResultSet;
use InvalidArgumentException;
use ApacheSolrForTypo3\Solr\Exception\InvalidArgumentException;

/**
* Class Sorting
Expand Down
2 changes: 1 addition & 1 deletion Classes/Domain/Search/ResultSet/Sorting/SortingHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

namespace ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Sorting;

use InvalidArgumentException;
use ApacheSolrForTypo3\Solr\Exception\InvalidArgumentException;
use TYPO3\CMS\Core\Utility\GeneralUtility;

/**
Expand Down
24 changes: 24 additions & 0 deletions Classes/Domain/Site/Exception/InvalidSiteRootPageException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/

namespace ApacheSolrForTypo3\Solr\Domain\Site\Exception;

use ApacheSolrForTypo3\Solr\Exception;

class InvalidSiteRootPageException extends Exception
{
}
2 changes: 1 addition & 1 deletion Classes/Domain/Site/SiteRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@

use ApacheSolrForTypo3\Solr\Domain\Index\Queue\RecordMonitor\Helper\RootPageResolver;
use ApacheSolrForTypo3\Solr\Domain\Site\Exception\UnexpectedTYPO3SiteInitializationException;
use ApacheSolrForTypo3\Solr\Exception\InvalidArgumentException;
use ApacheSolrForTypo3\Solr\FrontendEnvironment;
use ApacheSolrForTypo3\Solr\FrontendEnvironment\Tsfe;
use ApacheSolrForTypo3\Solr\System\Cache\TwoLevelCache;
use ApacheSolrForTypo3\Solr\System\Configuration\ExtensionConfiguration;
use ApacheSolrForTypo3\Solr\System\Records\Pages\PagesRepository;
use ApacheSolrForTypo3\Solr\System\Util\SiteUtility;
use Doctrine\DBAL\Exception as DBALException;
use InvalidArgumentException;
use Throwable;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Registry;
Expand Down
2 changes: 1 addition & 1 deletion Classes/Domain/Variants/IdBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

use ApacheSolrForTypo3\Solr\Domain\Site\Site;
use ApacheSolrForTypo3\Solr\Event\Variants\AfterVariantIdWasBuiltEvent;
use ApacheSolrForTypo3\Solr\Exception\InvalidArgumentException;
use ApacheSolrForTypo3\Solr\System\Solr\Document\Document;
use InvalidArgumentException;
use Psr\EventDispatcher\EventDispatcherInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;

Expand Down
27 changes: 27 additions & 0 deletions Classes/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

declare(strict_types=1);

/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/

namespace ApacheSolrForTypo3\Solr\Exception;

use ApacheSolrForTypo3\Solr\Exception;

/**
* Exception that is thrown if a given argument is invalid.
*/
class InvalidArgumentException extends Exception
{
}
2 changes: 1 addition & 1 deletion Classes/IndexQueue/Exception/IllegalStateException.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

namespace ApacheSolrForTypo3\Solr\IndexQueue\Exception;

use Exception;
use ApacheSolrForTypo3\Solr\Exception;

/**
* Exception that is thrown on indexing process and any potentially unusual state.
Expand Down
2 changes: 1 addition & 1 deletion Classes/IndexQueue/Exception/IndexingException.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

namespace ApacheSolrForTypo3\Solr\IndexQueue\Exception;

use Exception;
use ApacheSolrForTypo3\Solr\Exception;

/**
* Exception that is thrown on indexing process. Does not matter on which side, TYPO3 or Apache.
Expand Down
2 changes: 1 addition & 1 deletion Classes/IndexQueue/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
use ApacheSolrForTypo3\Solr\Domain\Index\Queue\QueueItemRepository;
use ApacheSolrForTypo3\Solr\Domain\Site\Site;
use ApacheSolrForTypo3\Solr\Domain\Site\SiteRepository;
use ApacheSolrForTypo3\Solr\Exception\InvalidArgumentException;
use Doctrine\DBAL\Exception as DBALException;
use InvalidArgumentException;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;

Expand Down
2 changes: 1 addition & 1 deletion Classes/IndexQueue/NoPidException.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

namespace ApacheSolrForTypo3\Solr\IndexQueue;

use Exception;
use ApacheSolrForTypo3\Solr\Exception;

/**
* This Exception is thrown when the RecordMonitor handles a record without a valid pid.
Expand Down
2 changes: 0 additions & 2 deletions Classes/NoSolrConnectionFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

namespace ApacheSolrForTypo3\Solr;

use Exception;

/**
* Exception that is thrown when no Solr connection could be found.
*
Expand Down
2 changes: 0 additions & 2 deletions Classes/PingFailedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

namespace ApacheSolrForTypo3\Solr;

use Exception;

/**
* Exception that is thrown when a ping fails
*
Expand Down
4 changes: 2 additions & 2 deletions Classes/System/Configuration/TypoScriptConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
namespace ApacheSolrForTypo3\Solr\System\Configuration;

use ApacheSolrForTypo3\Solr\Domain\Search\SearchRequest;
use ApacheSolrForTypo3\Solr\Exception\InvalidArgumentException;
use ApacheSolrForTypo3\Solr\IndexQueue\Indexer;
use ApacheSolrForTypo3\Solr\IndexQueue\Queue;
use ApacheSolrForTypo3\Solr\IndexQueue\Initializer\Record;
use ApacheSolrForTypo3\Solr\IndexQueue\Queue;
use ApacheSolrForTypo3\Solr\System\ContentObject\ContentObjectService;
use ApacheSolrForTypo3\Solr\System\Util\ArrayAccessor;
use InvalidArgumentException;
use TYPO3\CMS\Core\Utility\ArrayUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

namespace ApacheSolrForTypo3\Solr\System\Environment;

use Exception;
use ApacheSolrForTypo3\Solr\Exception;

/**
* Exception that is thrown when a language file is needed, but not available.
Expand Down
2 changes: 1 addition & 1 deletion Classes/System/Object/AbstractClassRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

namespace ApacheSolrForTypo3\Solr\System\Object;

use InvalidArgumentException;
use ApacheSolrForTypo3\Solr\Exception\InvalidArgumentException;
use stdClass;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
Expand Down
2 changes: 1 addition & 1 deletion Classes/System/Records/AbstractRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

namespace ApacheSolrForTypo3\Solr\System\Records;

use ApacheSolrForTypo3\Solr\Exception\InvalidArgumentException;
use Doctrine\DBAL\Exception as DBALException;
use InvalidArgumentException;
use RuntimeException;
use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Database\ConnectionPool;
Expand Down
2 changes: 1 addition & 1 deletion Classes/System/Records/Pages/PagesRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@

namespace ApacheSolrForTypo3\Solr\System\Records\Pages;

use ApacheSolrForTypo3\Solr\Exception\InvalidArgumentException;
use ApacheSolrForTypo3\Solr\System\Cache\TwoLevelCache;
use ApacheSolrForTypo3\Solr\System\Records\AbstractRepository;
use Doctrine\DBAL\ArrayParameterType;
use Doctrine\DBAL\Exception as DBALException;
use InvalidArgumentException;
use PDO;
use Throwable;
use TYPO3\CMS\Backend\Utility\BackendUtility;
Expand Down
2 changes: 1 addition & 1 deletion Classes/System/Solr/Parser/StopWordParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

namespace ApacheSolrForTypo3\Solr\System\Solr\Parser;

use InvalidArgumentException;
use ApacheSolrForTypo3\Solr\Exception\InvalidArgumentException;

/**
* Class to parse the stopwords from a solr response.
Expand Down
Loading

0 comments on commit 1ed1c4a

Please sign in to comment.