Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293641

DelayedRequeueException should call parent, and optionally allow providing default args

$
0
0

Problem/Motivation

I've identified some issues with \Drupal\Core\Queue\DelayedRequeueException introduced in #3116478: Add a way to silently keep an item locked when processing a queue via cron from a API perspective:

  • The constructor doesn't call parent, which is "highly recommended" by PHP exception documentation: https://www.php.net/manual/en/language.exceptions.extending.php#example-288

    If a class extends the built-in Exception class and re-defines the constructor, it is highly recommended that it also call parent::__construct() to ensure all available data has been properly assigned. The __toString() method can be overridden to provide a custom output when the object is presented as a string.

  • Its not possible to redefine the \Drupal\Core\Queue\DelayedRequeueException::$delay, this should be allowable with another method.
  • The constructor doesnt provide the ability to chain exceptions, such as by using the $previous constructor argument of most exceptions extending \Exception. Also $message and $code.
  • Documentation for \Drupal\Core\Queue\DelayedRequeueException::__construct and \Drupal\Core\Queue\DelayedRequeueException::getDelay should mention the unit: "seconds".

Setting to major for now since these seem like deficiencies that should be solved ASAP.

API changes

Perhaps breaks, if constructor args are re-ordered.


Viewing all articles
Browse latest Browse all 293641

Trending Articles