Skip to content

Commit ea5bb91

Browse files
committed
[TASK] add missing codes to thrown exceptions
Adds missing codes to thrown exceptions.
1 parent a5aefa8 commit ea5bb91

File tree

20 files changed

+105
-27
lines changed

20 files changed

+105
-27
lines changed

Classes/ConnectionManager.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,18 @@ public function getSolrConnectionForEndpoints(
9999
if (!isset(self::$connections[$connectionHash])) {
100100
$readEndpoint = new Endpoint($readEndpointConfiguration);
101101
if (!$this->isValidEndpoint($readEndpoint)) {
102-
throw new InvalidConnectionException('Invalid read endpoint');
102+
throw new InvalidConnectionException(
103+
'Invalid read endpoint',
104+
1451844097,
105+
);
103106
}
104107

105108
$writeEndpoint = new Endpoint($writeEndpointConfiguration);
106109
if (!$this->isValidEndpoint($writeEndpoint)) {
107-
throw new InvalidConnectionException('Invalid write endpoint');
110+
throw new InvalidConnectionException(
111+
'Invalid write endpoint',
112+
1049743991,
113+
);
108114
}
109115

110116
self::$connections[$connectionHash] = GeneralUtility::makeInstance(

Classes/ContentObject/Classification.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ class Classification extends AbstractContentObject
5151
public function render($conf = [])
5252
{
5353
if (!is_array($conf['classes.'])) {
54-
throw new InvalidArgumentException('No class configuration configured for SOLR_CLASSIFICATION object. Given configuration: ' . serialize($conf));
54+
throw new InvalidArgumentException(
55+
'No class configuration configured for SOLR_CLASSIFICATION object. Given configuration: ' . serialize($conf),
56+
8365879715,
57+
);
5558
}
5659

5760
$configuredMappedClasses = $conf['classes.'];
@@ -83,7 +86,10 @@ protected function buildClassificationsFromConfiguration(array $configuredMapped
8386
$classifications = [];
8487
foreach ($configuredMappedClasses as $class) {
8588
if ((empty($class['patterns']) && empty($class['matchPatterns'])) || empty($class['class'])) {
86-
throw new InvalidArgumentException('A class configuration in SOLR_CLASSIFCATION needs to have a pattern and a class configured. Given configuration: ' . serialize($class));
89+
throw new InvalidArgumentException(
90+
'A class configuration in SOLR_CLASSIFCATION needs to have a pattern and a class configured. Given configuration: ' . serialize($class),
91+
8715165614,
92+
);
8793
}
8894

8995
// @todo deprecate patterns configuration

Classes/Domain/Search/Query/ParameterBuilder/Operator.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ public function __construct(
4242
public function setOperator(string $operator): void
4343
{
4444
if (!in_array($operator, [self::OPERATOR_AND, self::OPERATOR_OR])) {
45-
throw new InvalidArgumentException('Invalid operator');
45+
throw new InvalidArgumentException(
46+
'Invalid operator',
47+
8402616466,
48+
);
4649
}
4750

4851
$this->operator = $operator;

Classes/Domain/Search/ResultSet/Facets/AbstractFacetPackage.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ public function getParser(): FacetParserInterface
3333
{
3434
$parser = GeneralUtility::makeInstance($this->getParserClassName());
3535
if (!$parser instanceof FacetParserInterface) {
36-
throw new InvalidFacetPackageException('Invalid parser for package ' . __CLASS__);
36+
throw new InvalidFacetPackageException(
37+
'Invalid parser for package ' . __CLASS__,
38+
8634008284,
39+
);
3740
}
3841

3942
return $parser;
@@ -51,7 +54,10 @@ public function getUrlDecoder(): FacetUrlDecoderInterface
5154
{
5255
$urlDecoder = GeneralUtility::makeInstance($this->getUrlDecoderClassName());
5356
if (!$urlDecoder instanceof FacetUrlDecoderInterface) {
54-
throw new InvalidUrlDecoderException('Invalid url-decoder for package ' . __CLASS__);
57+
throw new InvalidUrlDecoderException(
58+
'Invalid url-decoder for package ' . __CLASS__,
59+
9144462614,
60+
);
5561
}
5662

5763
return $urlDecoder;
@@ -69,7 +75,10 @@ public function getQueryBuilder(): FacetQueryBuilderInterface
6975
{
7076
$facetQueryBuilder = GeneralUtility::makeInstance($this->getQueryBuilderClassName());
7177
if (!$facetQueryBuilder instanceof FacetQueryBuilderInterface) {
72-
throw new InvalidQueryBuilderException('Invalid query-builder for package ' . __CLASS__);
78+
throw new InvalidQueryBuilderException(
79+
'Invalid query-builder for package ' . __CLASS__,
80+
5405805432,
81+
);
7382
}
7483

7584
return $facetQueryBuilder;

Classes/Domain/Search/ResultSet/Facets/FacetRegistry.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,10 @@ public function getPackage(string $type): AbstractFacetPackage
8686
{
8787
$instance = $this->getInstance($type);
8888
if (!$instance instanceof AbstractFacetPackage) {
89-
throw new InvalidFacetPackageException('Invalid class registered for ' . htmlspecialchars($type));
89+
throw new InvalidFacetPackageException(
90+
'Invalid class registered for ' . htmlspecialchars($type),
91+
2019898766,
92+
);
9093
}
9194
return $instance;
9295
}

Classes/Domain/Search/ResultSet/Facets/RequirementsService.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ protected function getSelectedItemValues(AbstractFacet $facet, string $facetName
8181
{
8282
$facetToCheckRequirements = $facet->getResultSet()->getFacets()->getByName($facetNameToCheckRequirementsOn)->getByPosition(0);
8383
if (!$facetToCheckRequirements instanceof AbstractFacet) {
84-
throw new InvalidArgumentException('Requirement for unexisting facet configured');
84+
throw new InvalidArgumentException(
85+
'Requirement for non-existing facet configured',
86+
4953268822,
87+
);
8588
}
8689

8790
if (!$facetToCheckRequirements->getIsUsed()) {

Classes/Domain/Search/ResultSet/ResultSetReconstitutionProcessor.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,10 @@ private function parseSpellCheckingResponseIntoObjects(SearchResultSet $resultSe
135135
}
136136

137137
if ($misspelledTerm === '') {
138-
throw new UnexpectedValueException('No misspelled term before suggestion');
138+
throw new UnexpectedValueException(
139+
'No misspelled term before suggestion',
140+
4271427727,
141+
);
139142
}
140143

141144
if (!is_object($suggestionData) && !is_array($suggestionData->suggestion)) {

Classes/Domain/Search/ResultSet/SearchResultSetService.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,10 @@ public function getDocumentById(string $documentId): SearchResult
299299
$resultDocument = $parsedData->response->docs[0] ?? null;
300300

301301
if (!$resultDocument instanceof Document) {
302-
throw new UnexpectedValueException('Response did not contain a valid Document object');
302+
throw new UnexpectedValueException(
303+
'Response did not contain a valid Document object',
304+
1113053393,
305+
);
303306
}
304307

305308
return $this->searchResultBuilder->fromApacheSolrDocument($resultDocument);

Classes/Domain/Search/ResultSet/Sorting/Sorting.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ public function __construct(
5353
bool $isResetOption = false,
5454
) {
5555
if (!self::getIsValidDirection($direction)) {
56-
throw new InvalidArgumentException('Invalid sorting direction');
56+
throw new InvalidArgumentException(
57+
'Invalid sorting direction',
58+
8919514853,
59+
);
5760
}
5861
$this->name = $name;
5962
$this->direction = $direction;

Classes/Domain/Variants/IdBuilder.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ public function buildFromTypeAndUid(string $type, int $uid, array $itemRecord, S
5757
protected function getSystemHash(): string
5858
{
5959
if (!isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'])) {
60-
throw new InvalidArgumentException('No sitename set in TYPO3_CONF_VARS|SYS|sitename');
60+
throw new InvalidArgumentException(
61+
'No sitename set in TYPO3_CONF_VARS|SYS|sitename',
62+
8666989008,
63+
);
6164
}
6265

6366
$siteName = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];

0 commit comments

Comments
 (0)