[ 
https://issues.apache.org/jira/browse/SLING-6967?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16055321#comment-16055321
 ] 

Radu Cotescu commented on SLING-6967:
-------------------------------------

[~kwin], could you please add a code example or a small content package that 
showcases the problem?

> Allow to throw exceptions in data-sly-resource for invalid paths
> ----------------------------------------------------------------
>
>                 Key: SLING-6967
>                 URL: https://issues.apache.org/jira/browse/SLING-6967
>             Project: Sling
>          Issue Type: Improvement
>          Components: Scripting
>    Affects Versions: Scripting HTL Engine 1.0.34
>            Reporter: Konrad Windszus
>
> If the path for {{data-sly-resource}} is dynamic you need to set it via 
> expression language. If the underlying Java Pojo throws an exception while 
> retrieving the path this exception is being caught by HTL EL and leads to the 
> empty path (i.e. the behaviour is changed drastically because the wrong 
> resource is being included)
> Since propagating the exception through the HTL EL is probably an 
> incompatible change I would suggest to add an additional optional option like 
> {{isInvalidPath}}. If that is set to {{true}} there should be a 
> {{SightlyException}} thrown with an according error message that the given 
> path is invalid.
> A concrete use case for that is a reference component, which would otherwise 
> end up in a cycle because it would otherwise include itself.
> The only other workaround would be to use {{data-sly-test}} on the 
> dynamically retrieved path, but it would not be possible to throw an 
> exception here (and therefore break rendering of the whole HTL script).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to