Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-6967

Allow to throw exceptions in data-sly-resource for invalid paths

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • Scripting HTL Engine 1.0.34
    • None
    • Scripting
    • None

    Description

      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).

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              kwin Konrad Windszus
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: