diff --git a/core/modules/views/src/Plugin/views/query/Sql.php b/core/modules/views/src/Plugin/views/query/Sql.php index eaabd70..c481a85 100644 --- a/core/modules/views/src/Plugin/views/query/Sql.php +++ b/core/modules/views/src/Plugin/views/query/Sql.php @@ -1454,8 +1454,7 @@ function execute(ViewExecutable $view) { drupal_set_message($e->getMessage(), 'error'); } else { - $view_storage_label = $view->storage->label()[$view->storage->id()]; - throw new DatabaseExceptionWrapper("Exception in {$view_storage_label}: {$e->getMessage()}"); + throw new DatabaseExceptionWrapper("Exception in {$view->storage->label()}[{$view->storage->id()}]: {$e->getMessage()}"); } } diff --git a/core/modules/views/src/Tests/Plugin/FilterExceptionTest.php b/core/modules/views/src/Tests/Plugin/FilterExceptionTest.php index ed00dad..28f6c50 100644 --- a/core/modules/views/src/Tests/Plugin/FilterExceptionTest.php +++ b/core/modules/views/src/Tests/Plugin/FilterExceptionTest.php @@ -72,13 +72,13 @@ public function testFilterException() { ), )); - $exception_assert_message = 'Exception'; try { $this->executeView($view); - $this->fail($exception_assert_message); + $this->fail('Expected exception not thrown.'); } catch (DatabaseExceptionWrapper $e) { - $this->pass($exception_assert_message); + $exception_assert_message = "Exception in {$view->storage->label()}[{$view->storage->id()}]"; + $this->assertEqual(strstr($e->getMessage(), ':', TRUE), $exception_assert_message); } } diff --git a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/filter/FilterExceptionTest.php b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/filter/FilterExceptionTest.php index e727086..bde6604 100644 --- a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/filter/FilterExceptionTest.php +++ b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/filter/FilterExceptionTest.php @@ -9,7 +9,6 @@ use Drupal\Core\Form\FormStateInterface; use Drupal\views\Plugin\views\filter\FilterPluginBase; -use Drupal\Core\Database\DatabaseExceptionWrapper; /** * @ViewsFilter("test_exception_filter") @@ -47,9 +46,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { * Overrides Drupal\views\Plugin\views\filter\FilterPluginBase::query(). */ public function query() { - if ($this->options['test_enable']) { - throw new DatabaseExceptionWrapper("Exception"); - } + $this->query->addWhereExpression(NULL, "syntax error"); } }