You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Konrad Windszus (JIRA)" <ji...@apache.org> on 2017/06/20 07:44:02 UTC

[jira] [Created] (SLING-6967) Allow to throw exceptions in data-sly-resource for invalid paths

Konrad Windszus created SLING-6967:
--------------------------------------

             Summary: 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)