Skip to content
Snippets Groups Projects

Issue #3336247: Throw an exception if stopPropagation() called for `PreOperationStageEvent` and no error has been added

Merged Issue #3336247: Throw an exception if stopPropagation() called for `PreOperationStageEvent` and no error has been added
All threads resolved!
All threads resolved!
Files
2
@@ -6,6 +6,7 @@ namespace Drupal\package_manager\Event;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\package_manager\ValidationResult;
use Drupal\system\SystemManager;
/**
* Base class for events dispatched before a stage life cycle operation.
@@ -63,4 +64,14 @@ abstract class PreOperationStageEvent extends StageEvent {
$this->results[] = ValidationResult::createErrorFromThrowable($throwable, $summary);
}
/**
* {@inheritdoc}
*/
public function stopPropagation(): void {
if (empty($this->getResults(SystemManager::REQUIREMENT_ERROR))) {
$this->addErrorFromThrowable(new \LogicException('Event propagation stopped without any errors added to the event. This bypasses the package_manager validation system.'));
}
parent::stopPropagation();
}
}
Loading