function ComposerStagerExceptionTrait::setException
Sets an exception to be thrown.
Parameters
string|null $class: The class of exception to throw, or NULL to delete a stored exception.
mixed ...$arguments: Arguments to pass to the exception constructor.
File
-
core/
modules/ package_manager/ tests/ modules/ package_manager_bypass/ src/ ComposerStagerExceptionTrait.php, line 22
Class
- ComposerStagerExceptionTrait
- Trait to make Composer Stager throw pre-determined exceptions in tests.
Namespace
Drupal\package_manager_bypassCode
public static function setException(?string $class = \Exception::class, mixed ...$arguments) : void {
if ($class) {
\Drupal::state()->set(static::class . '-exception', func_get_args());
}
else {
\Drupal::state()->delete(static::class . '-exception');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.