function SqlContentEntityStorage::wrapSchemaException

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php \Drupal\Core\Entity\Sql\SqlContentEntityStorage::wrapSchemaException()
  2. 8.9.x core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php \Drupal\Core\Entity\Sql\SqlContentEntityStorage::wrapSchemaException()
  3. 11.x core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php \Drupal\Core\Entity\Sql\SqlContentEntityStorage::wrapSchemaException()

Wraps a database schema exception into an entity storage exception.

Parameters

callable $callback: The callback to be executed.

Throws

\Drupal\Core\Entity\EntityStorageException When a database schema exception is thrown.

8 calls to SqlContentEntityStorage::wrapSchemaException()
SqlContentEntityStorage::onEntityTypeCreate in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
SqlContentEntityStorage::onEntityTypeDelete in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
SqlContentEntityStorage::onEntityTypeUpdate in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
SqlContentEntityStorage::onFieldableEntityTypeCreate in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
SqlContentEntityStorage::onFieldableEntityTypeUpdate in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php

... See full list

File

core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php, line 1594

Class

SqlContentEntityStorage
A content entity database storage implementation.

Namespace

Drupal\Core\Entity\Sql

Code

protected function wrapSchemaException(callable $callback) {
    $message = 'Exception thrown while performing a schema update.';
    try {
        $callback();
    } catch (SchemaException $e) {
        $message .= ' ' . $e->getMessage();
        throw new EntityStorageException($message, 0, $e);
    } catch (DatabaseExceptionWrapper $e) {
        $message .= ' ' . $e->getMessage();
        throw new EntityStorageException($message, 0, $e);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.