You are here

protected function SqlContentEntityStorage::wrapSchemaException in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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.

6 calls to SqlContentEntityStorage::wrapSchemaException()
SqlContentEntityStorage::onEntityTypeCreate in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
Reacts to the creation of the entity type.
SqlContentEntityStorage::onEntityTypeDelete in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
Reacts to the deletion of the entity type.
SqlContentEntityStorage::onEntityTypeUpdate in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
Reacts to the update of the entity type.
SqlContentEntityStorage::onFieldStorageDefinitionCreate in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
Reacts to the creation of a field storage definition.
SqlContentEntityStorage::onFieldStorageDefinitionDelete in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
Reacts to the deletion of a field storage definition.

... See full list

File

core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php, line 1450
Contains \Drupal\Core\Entity\Sql\SqlContentEntityStorage.

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);
  }
}