Extra Block Types (EBT) - New Layout Builder experience❗
Extra Block Types (EBT) - styled, customizable block types: Slideshows, Tabs, Cards, Accordions and many others. Built-in settings for background, DOM Box, javascript plugins. Experience the future of layout building today.
❗Extra Paragraph Types (EPT) - New Paragraphs experience
Extra Paragraph Types (EPT) - analogical paragraph based set of modules.
Scroll
Logging errors
02/10/2025, by Ivan
Menu
- Understanding Drupal
- Drupal System Requirements
- Installing Drupal 8
- Drupal 8 Update
- Drupal Site Administration
- Drupal 8 Modules
- Drupal Modules Comparison
- Drupal Themes
- Drupal field types
- Configuration Management
- Multisite Drupal
- Accessibility Features
- Troubleshooting in Drupal
- Creating modules for Drupal
- Drupal 8 API
- Theming in Drupal
- Upgrade to Drupal 11
The Database API throws exceptions on error, which can be caught by wrapping database operations in try {} catch() {} blocks, as shown in this example:
// The transaction opens here. $txn = $connection->startTransaction(); try { $id = $connection->insert('example') ->fields([ 'field1' => 'mystring', 'field2' => 5, ]) ->execute(); my_other_function($id); return $id; } catch (Exception $e) { // Something went wrong somewhere, so roll back now. $txn->rollBack(); // Log the exception to watchdog. \Drupal::logger('type')->error($e->getMessage()); }