Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EZP-31021: Revised exception and command messages #162

Merged
merged 2 commits into from
Dec 2, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bundle/Command/SolrCreateIndexCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ protected function execute(InputInterface $input, OutputInterface $output)
$purge = !$input->getOption('no-purge');
$bulkCount = $input->getArgument('bulk_count');
if (!is_numeric($bulkCount) || (int)$bulkCount < 1) {
throw new RuntimeException("'bulk_count' argument should be > 0, got '{$bulkCount}'");
throw new RuntimeException("The 'bulk_count' argument should be > 0, you provided '{$bulkCount}'");
DominikaK marked this conversation as resolved.
Show resolved Hide resolved
}

/** @var \eZ\Publish\SPI\Search\Handler $searchHandler */
$searchHandler = $this->getContainer()->get('ezpublish.spi.search');
if (!$searchHandler instanceof SolrSearchEngineHandler) {
throw new RuntimeException(
'Expected to find Solr Search Engine but found something else. ' .
"Did you forget to configure the repository with 'solr' search engine?"
'Did not find Solr Search Engine. ' .
"Did you configure the Repository with the 'solr' search engine?"
);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Container/Compiler/CoreFilterRegistryPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public function process(ContainerBuilder $container): void
foreach ($attributes as $attribute) {
if (!isset($attribute['connection'])) {
throw new LogicException(
"'ezpublish.search.solr.core_filter' service tag needs an 'connection' attribute " .
'to identify the Gateway. None given.'
"'ezpublish.search.solr.core_filter' service tag needs a 'connection' attribute " .
'to identify the Gateway.'
);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Container/Compiler/EndpointRegistryPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function process(ContainerBuilder $container)
if (!isset($attribute['alias'])) {
throw new LogicException(
"'ezpublish.search.solr.endpoint' service tag needs an 'alias' attribute " .
'to identify the Endpoint. None given.'
'to identify the endpoint.'
);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Container/Compiler/GatewayRegistryPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public function process(ContainerBuilder $container): void
foreach ($attributes as $attribute) {
if (!isset($attribute['connection'])) {
throw new LogicException(
"'ezpublish.search.solr.gateway' service tag needs an 'connection' attribute " .
'to identify the Gateway. None given.'
"'ezpublish.search.solr.gateway' service tag needs a 'connection' attribute " .
'to identify the Gateway.'
);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Gateway/EndpointRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function registerEndpoint($name, Endpoint $endpoint)
public function getEndpoint($name)
{
if (!isset($this->endpoint[$name])) {
throw new OutOfBoundsException("No Endpoint registered for '{$name}'.");
throw new OutOfBoundsException("No endpoint registered for '{$name}'.");
}

return $this->endpoint[$name];
Expand Down
2 changes: 1 addition & 1 deletion lib/Gateway/EndpointResolver/NativeEndpointResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function __construct(
public function getEntryEndpoint()
{
if (empty($this->entryEndpoints)) {
throw new RuntimeException('Not entry endpoints defined');
throw new RuntimeException('No entry endpoints defined');
}

return reset($this->entryEndpoints);
Expand Down
4 changes: 2 additions & 2 deletions lib/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ public function findSingle(Criterion $filter, array $languageFilter = array())
);

if (!$result->totalCount) {
throw new NotFoundException('Content', 'findSingle() found no content for given $filter');
throw new NotFoundException('Content', 'findSingle() found no content for the given $filter');
} elseif ($result->totalCount > 1) {
throw new InvalidArgumentException('totalCount', 'findSingle() found more then one item for given $filter');
throw new InvalidArgumentException('totalCount', 'findSingle() found more then one Content item for the given $filter');
}

$first = reset($result->searchHits);
Expand Down
2 changes: 1 addition & 1 deletion lib/Query/Common/CriterionVisitor/Field/FieldIn.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function visit(Criterion $criterion, CriterionVisitor $subVisitor = null)
if (empty($searchFields)) {
throw new InvalidArgumentException(
'$criterion->target',
"No searchable fields found for the given criterion target '{$criterion->target}'."
"No searchable Fields found for the provided Criterion target '{$criterion->target}'."
);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Query/Common/CriterionVisitor/Field/FieldLike.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function visit(Criterion $criterion, CriterionVisitor $subVisitor = null)
if (empty($searchFields)) {
throw new InvalidArgumentException(
'$criterion->target',
"No searchable fields found for the given criterion target '{$criterion->target}'."
"No searchable Fields found for the provided Criterion target '{$criterion->target}'."
);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Query/Common/CriterionVisitor/Field/FieldRange.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function visit(Criterion $criterion, CriterionVisitor $subVisitor = null)
if (empty($searchFields)) {
throw new InvalidArgumentException(
'$criterion->target',
"No searchable fields found for the given criterion target '{$criterion->target}'."
"No searchable Fields found for the provided Criterion target '{$criterion->target}'."
);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Query/Common/CriterionVisitor/Field/FieldRelation.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function visit(Criterion $criterion, CriterionVisitor $subVisitor = null)
if (empty($searchFields)) {
throw new InvalidArgumentException(
'$criterion->target',
"No searchable fields found for the given criterion target '{$criterion->target}'."
"No searchable Fields found for the provided Criterion target '{$criterion->target}'."
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function visit(Criterion $criterion, CriterionVisitor $subVisitor = null)
if (empty($searchFields)) {
throw new InvalidArgumentException(
'$criterion->target',
"No searchable fields found for the given criterion target '{$criterion->target}'."
"No searchable Fields found for the provided Criterion target '{$criterion->target}'."
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function visit(Criterion $criterion, CriterionVisitor $subVisitor = null)
if (empty($searchFields)) {
throw new InvalidArgumentException(
'$criterion->target',
"No searchable fields found for the given criterion target '{$criterion->target}'."
"No searchable Fields found for the provided Criterion target '{$criterion->target}'."
);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Query/Common/SortClauseVisitor/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function visit(SortClause $sortClause)
if ($fieldName === null) {
throw new InvalidArgumentException(
'$sortClause->targetData',
'No searchable fields found for the given sort clause target ' .
'No searchable Fields found for the provided Sort Clause target ' .
"'{$target->fieldIdentifier}' on '{$target->typeIdentifier}'."
);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Query/Common/SortClauseVisitor/MapLocationDistance.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function visit(SortClause $sortClause)
if ($fieldName === null) {
throw new InvalidArgumentException(
'$sortClause->targetData',
'No searchable fields found for the given sort clause target ' .
'No searchable Fields found for the provided Sort Clause target ' .
"'{$target->fieldIdentifier}' on '{$target->typeIdentifier}'."
);
}
Expand Down
6 changes: 3 additions & 3 deletions lib/Query/FacetBuilderVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ abstract class FacetBuilderVisitor
*/
public function canMap($field)
{
throw new \LogicException('Deprecated in favour of FacetFieldVisitor, and not in use if that is implemented');
throw new \LogicException('Deprecated in favour of FacetFieldVisitor, not in use if FacetFieldVisitor is implemented');
}

/**
Expand All @@ -43,7 +43,7 @@ public function canMap($field)
*/
public function map($field, array $data)
{
throw new \LogicException('Deprecated in favour of FacetFieldVisitor, and not in use if that is implemented');
throw new \LogicException('Deprecated in favour of FacetFieldVisitor, not in use if FacetFieldVisitor is implemented');
}

/**
Expand All @@ -66,7 +66,7 @@ abstract public function canVisit(FacetBuilder $facetBuilder);
*/
public function visit(FacetBuilder $facetBuilder)
{
throw new \LogicException('Deprecated in favour of FacetFieldVisitor, and not in use if that is implemented');
throw new \LogicException('Deprecated in favour of FacetFieldVisitor, not in use if FacetFieldVisitor is implemented');
}

/**
Expand Down