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

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
2016-10-29 09:43:30
Comments
Leave a Comment

Please login to continue.