Skip to content

#317 - Throw exceptions implementing ProcessExceptionInterface instead of raw SPL exceptions - #321

Merged
njoubert-cleverage merged 1 commit into
mainfrom
317
Oct 20, 2026
Merged

njoubert-cleverage merged 1 commit into
mainfrom
317

Conversation

@njoubert-cleverage

Copy link
Copy Markdown
Member

Description

Fixes #317.

  • New exceptions in Exception/, extending the SPL exceptions thrown until now and implementing ProcessExceptionInterface: UnexpectedValueException, RuntimeException, InvalidArgumentException, LogicException.
  • The 124 throw new \<SPL exception> of src/ use them (75 UnexpectedValueException, 18 RuntimeException, 16 InvalidArgumentException, 15 LogicException): same messages and codes. Mechanical change (imports + throw), no other line changed.
  • All the errors of the bundle can be caught with catch (ProcessExceptionInterface $e). Not concerned: the exceptions of the Symfony components thrown by the bundle (InvalidOptionsException, InvalidConfigurationException…) and the ones of the application tasks and transformers.
  • Documentation: "Process execution flow" (advanced workflow). CHANGELOG.

Tests: SplExceptionsTest (each exception extends its SPL class and implements the interface; an error of a transformer is caught with the interface). The existing tests expecting the SPL classes pass unchanged.

Checked in the container (987 tests): highest dependencies (PHP 8.5, Symfony 8.1), lowest dependencies (PHP 8.2, Symfony 6.4.0), Symfony 6.4.48 on PHP 8.2 and 8.5, Symfony 7.4: no deprecation, no risky test (with pcov coverage). PHPStan, PHP-CS-Fixer and Rector OK.

Requirements

  • Documentation updates
    • Reference
    • Cookbooks
    • Changelog
  • Unit tests

Breaking changes

None: the new exceptions extend the SPL classes thrown until now, the existing catch and expectException() keep working.

🤖 Generated with Claude Code

…d of raw SPL exceptions

- New Exception\UnexpectedValueException, RuntimeException,
  InvalidArgumentException and LogicException, extending the SPL
  exceptions and implementing ProcessExceptionInterface.
- The 124 throw of raw SPL exceptions use them (same messages): the
  errors of the bundle can be caught with ProcessExceptionInterface, the
  existing catch on the SPL classes keep working.
- Tests, documentation (advanced workflow) and CHANGELOG updated.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Throw exceptions implementing ProcessExceptionInterface instead of raw SPL exceptions

1 participant