-
-
Notifications
You must be signed in to change notification settings - Fork 313
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
ux_icon triggers an exception when icon doesn't exists #2008
Comments
Really sorry to hear that. Unfortunately, many users expect an exception in this specific case, so i don't think we would silent them here. However.... we recently merged #1889, which exposes an interface for the IconRenderer and will be available in the next release (in the coming weeks). You could then decorate the IconRenderer to catch potential exceptions? |
I don't really agree here, you don't want you app to crash if an icon is not able to be rendered. I understand the benefit in thrownig an error, but in development only. Before Symfony UX Icon, we used things like Something like a strict mode, like Twig and variables. Depending of the configuration (by default |
That's very debatable :) So yeah, a configuration option could please everyone. And what about a "default" icon ? |
Thank you for that PR! |
Description
The twig
ux_icon
function always triggers an exception when the icon name doesn't exists.In my opinion, since icons are usually not a critical feature (most of the time only for design purpose), this should trigger an exception only in
dev
mode by default and the exception should be catched with an error message in logs inprod
mode.Maybe by adding an option to the UX Icons component to configure this?
Example
I have a feature in my app where the admin can add icons to display in the app.
One icon has been added with a typo and this put few pages of our site down.
The text was updated successfully, but these errors were encountered: