ServerNotAvailableException example

use Shopware\Elasticsearch\Exception\ServerNotAvailableException;

/** * @internal * * @covers \Shopware\Elasticsearch\Exception\ServerNotAvailableException */
class ServerNotAvailableExceptionTest extends TestCase
{
    public function testException(): void
    {
        $exception = new ServerNotAvailableException();
        static::assertStringContainsString('Elasticsearch server is not available', $exception->getMessage());
        static::assertSame('ELASTICSEARCH_SERVER_NOT_AVAILABLE', $exception->getErrorCode());
    }
}
return $this->prefix . '_' . $definition->getEntityName() . '_' . $languageId;
    }

    public function allowIndexing(): bool
    {
        if (!$this->indexingEnabled) {
            return false;
        }

        if (!$this->client->ping()) {
            return $this->logAndThrowException(new ServerNotAvailableException());
        }

        return true;
    }

    /** * Validates if it is allowed do execute the search request over elasticsearch */
    public function allowSearch(EntityDefinition $definition, Context $context, Criteria $criteria): bool
    {
        if (!$this->searchEnabled) {
            
Home | Imprint | This part of the site doesn't use cookies.