Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception handling when running steps #65

Open
reimic opened this issue Mar 6, 2024 · 0 comments
Open

Exception handling when running steps #65

reimic opened this issue Mar 6, 2024 · 0 comments
Labels
Architecture enhancement New feature or request

Comments

@reimic
Copy link
Collaborator

reimic commented Mar 6, 2024

Most methods executed by step runners can raise a exceptions. Until now this was handled within those methods, but it has proven itself to be quite cumbersome. It's quite easy to forget to properly wrap a method invocation with a try-catch and thus allowing for an issue in a single step to fail a whole blueprint. Also - that's quite a boilerplate-heavy solution.

As a potential solution - exceptions would be handled in the orchestrating BlueprintRunner.php, thus "globally" protecting the execution flow, with no need for extra boilerplate and no risk of exception-leakage.

@reimic reimic added enhancement New feature or request Architecture labels Mar 6, 2024
@reimic reimic mentioned this issue Mar 6, 2024
adamziel pushed a commit that referenced this issue Mar 28, 2024
### What does this PR do?
- removes the try / catch block from the `RmStepRunner`
- renames some variables in the test class for better readability and to
match linting standards

### What problem does it fix?
- the runner was catching IOExceptions, but we agreed it shouldn't #65
- some variables could've been named better

### How to test if it works?
- this PR includes tests for `RmStepRunner`
- all tests should pass for all supported PHP versions
adamziel pushed a commit that referenced this issue Apr 3, 2024
`MkdirStepRunner` will now:
- handle both relative and absolute paths
- throw an exception if the directory it wants to create already exists
- throw an original Symfony Filesystem `IOException` not rewrapping it
into a `BlueprintException`, as agreed in #65

### What problem does it fix?
- until now the runner would only handle absolute paths
- has thrown an exception in a bad way
- we use this step in the `examples` directory, and since it only
accepted absolute paths and we have provided it a relative path the
example was flawed

### How to test if it works?
- this PR includes a full suite of tests for this runner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Architecture enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant