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

improve error message #192

Closed
dbu opened this issue Jun 10, 2013 · 12 comments
Closed

improve error message #192

dbu opened this issue Jun 10, 2013 · 12 comments
Labels
Attn: Inactive 💤 This issue or PR does not appear to be active and such items will be regularly closed. Level: Enhancement ✨ This item involves an enhancement to existing functionality.

Comments

@dbu
Copy link
Member

dbu commented Jun 10, 2013

when i manage to pass an empty path into the imagine_filter twig function (e.g. i have a phpcr Image document that is null). now instead of getting some message like "Invalid image source" i get "An exception has been thrown during the rendering of a template ("Parameter "path" for route "_imagine_home_slideshow" must match ".+" ("" given) to generate a corresponding URL.")"

the last step is in CacheManager::generateUrl - is it sane to assume there that if the path is empty we do have a problem? or are there use cases where path can legally be empty?

i am happy to do a PR for this, but wanted to ask first if it makes sense at all.

@havvg
Copy link
Contributor

havvg commented Jun 10, 2013

I don't see any use case for an empty path on this route.

@Tobion
Copy link

Tobion commented Jun 10, 2013

You won't even get this exception in production environment using SE config because the requirement check does not take place then. It instead will generate such a route with empty path anyway.

@dbu
Copy link
Member Author

dbu commented Jun 10, 2013

hm, but then is it better if we silently ignore the issue or throw an
exception? i guess in dev its nice to see there is an issue. but in
production i prefer a page to not show an image rather than have a
server error and not show up at all.
should we check if kernel.debug is active and only then validate the path?

@havvg
Copy link
Contributor

havvg commented Jun 10, 2013

@Tobion Are you sure on this? It sounds scary and wrong to me, I'm not using SE config, which option is it that enables this behavior?

@havvg
Copy link
Contributor

havvg commented Jun 10, 2013

Well, found it myself; strict_requirements it is.

@havvg
Copy link
Contributor

havvg commented Jun 10, 2013

I would suggest to result in a 404 if the path is empty. A better solution would be to add an event to resolve this 404 if the user likes to, e.g. fallback image on filter_set basis.

@dbu
Copy link
Member Author

dbu commented Jun 10, 2013

so we actually would change the route path requirements to .* instead of
.+, right? and then handle the fact that we are called with no path and
result in a 404?

@Tobion
Copy link

Tobion commented Jun 10, 2013

Well this check is only disabled for generating urls for performance reasons, not for matching. So a wrongly generated url would result in 404 anyway (unless another route matches).

@havvg
Copy link
Contributor

havvg commented Jun 10, 2013

Ah, that makes more sense. Then I would stick with the first solution, to make the exception more readable (in case path is empty), so no invalid URL is generated.

@makasim makasim modified the milestones: v1.1, v0.20.x May 22, 2014
@makasim
Copy link
Collaborator

makasim commented May 22, 2014

moving to 1.1 milestone as 0.20 is not supported any more.

@robfrawley robfrawley removed the Attn: Critical This issue or PR is critical and should be rushed into a new release ASAP. label Sep 27, 2016
@robfrawley robfrawley removed this from the v1.1-missed milestone Jan 25, 2017
@michellesanver
Copy link
Contributor

Does this still make sense for you @dbu ?

@michellesanver michellesanver added Attn: Inactive 💤 This issue or PR does not appear to be active and such items will be regularly closed. Level: Enhancement ✨ This item involves an enhancement to existing functionality. labels Oct 4, 2019
@dbu
Copy link
Member Author

dbu commented Oct 4, 2019

lets drop it :-)

@dbu dbu closed this as completed Oct 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Attn: Inactive 💤 This issue or PR does not appear to be active and such items will be regularly closed. Level: Enhancement ✨ This item involves an enhancement to existing functionality.
Projects
None yet
Development

No branches or pull requests

6 participants