SqlContentEntityStorage::wrapSchemaException

protected SqlContentEntityStorage::wrapSchemaException(callable $callback)

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.

File

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

Class

SqlContentEntityStorage
A content entity database storage implementation.

Namespace

Drupal\Core\Entity\Sql

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
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);
  }
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.