You are here

protected function SqlContentEntityStorage::wrapSchemaException in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php \Drupal\Core\Entity\Sql\SqlContentEntityStorage::wrapSchemaException()
  2. 9 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
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::onFieldableEntityTypeCreate in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
Reacts to the creation of the fieldable entity type.
SqlContentEntityStorage::onFieldableEntityTypeUpdate in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
Reacts to the update of a fieldable entity type.

... See full list

File

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

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