Services that lazily create database tables should catch SchemaObjectExistsException and SchemaObjectNotExistsException as needed, rather than Exception

Created on 18 March 2024, 9 months ago

Problem/Motivation

Some services that create their database tables lazily (only when needed) have code like this (from \Drupal\Core\Cache\DatabaseBackend::getMultiple()):

    try {
      // Some database stuff
    }
    catch (\Exception $e) {
      // Nothing to do.
    }

These should not be catching the very general-purpose \Exception or \Throwable classes. They should be instead specifically capturing SchemaObjectNotExistsException (if they're trying to access a non-existent table) or SchemaObjectExistsException (if they're trying to create a table that has already been created). Additionally, they should be converted to non-capturing catches if they're not going to actually do anything with the exception.

πŸ“Œ Task
Status

Closed: duplicate

Version

11.0 πŸ”₯

Component
BaseΒ  β†’

Last updated 2 days ago

Created by

πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @phenaproxima
  • Pipeline finished with Canceled
    9 months ago
    Total: 83s
    #122374
  • Pipeline finished with Canceled
    9 months ago
    Total: 47s
    #122375
  • Pipeline finished with Failed
    9 months ago
    Total: 175s
    #122376
  • Pipeline finished with Canceled
    9 months ago
    #122379
  • Pipeline finished with Failed
    9 months ago
    Total: 675s
    #122380
  • Pipeline finished with Failed
    9 months ago
    Total: 174s
    #122402
  • Pipeline finished with Canceled
    9 months ago
    Total: 482s
    #122409
  • Pipeline finished with Canceled
    9 months ago
    Total: 183s
    #122419
  • Pipeline finished with Canceled
    9 months ago
    #122425
  • Pipeline finished with Running
    9 months ago
    #122427
  • Pipeline finished with Success
    9 months ago
    Total: 514s
    #122442
  • Pipeline finished with Success
    9 months ago
    Total: 492s
    #122477
  • Pipeline finished with Failed
    9 months ago
    #122514
  • Pipeline finished with Canceled
    9 months ago
    Total: 69s
    #122516
  • Pipeline finished with Canceled
    9 months ago
    Total: 20s
    #122518
  • Pipeline finished with Canceled
    9 months ago
    Total: 49s
    #122519
  • Pipeline finished with Canceled
    9 months ago
    Total: 162s
    #122521
  • Pipeline finished with Failed
    9 months ago
    Total: 508s
    #122523
  • Status changed to Closed: duplicate 9 months ago
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts
Production build 0.71.5 2024