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

[BUGFIX] __construct: added try catch block #57

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/TwigRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,14 @@ function __construct(array $config) {
if (isset($this->config['src']['namespaces'])) {
foreach ($this->config['src']['namespaces'] as $namespace) {
foreach ($namespace['paths'] as $path) {
$this->loader->addPath($path, $namespace['id']);
// The twigRenderer tries to access paths which
// might be not present anymore. In that case we
// have to catch this
try {
$this->loader->addPath($path, $namespace['id']);
} catch (Throwable $e) {
// ignore
Copy link
Contributor

@neclimdul neclimdul Apr 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

empty catch blocks always have me go 🤔

Could we report this back as some sort of notice or warning so a developer can clean up the problematic code?

}
}
}
}
Expand Down