Uploaded image for project: 'Magnolia DAM Module'
  1. Magnolia DAM Module
  2. MGNLDAM-633

Requesting an AssetRendition for an unknown ItemKey shouldn't result in two warnings in the log

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Won't Do
    • Icon: Neutral Neutral
    • None
    • 2.1.1
    • DAM Templating
    • None

      If an AssetRendition is requested via DamTemplatingFunctions#getRendition, which can also be damfn.getRendition in a template, and not item can be found, this results in two warnings in the log and a null return value:

      WARN   info.magnolia.dam.templating.functions.DamTemplatingFunctions 03.01.2016 19:57:00 -- The following ItemKey 'media' generated exceptions when trying to retrieve the associated Item : ItemKey is not valid.
      WARN   info.magnolia.dam.templating.functions.DamTemplatingFunctions 03.01.2016 19:57:00 -- Trying to get asset with item key media returned null.
      

      The first warning seems to come from the private getItem method, and the second one from the getRendition method which calls the getItem method.

      I think it would be better if the private getItem method would not log a warning and return null, but would throw an exception. That exception could be catched by getRendition and logged there (or it could be (re)thrown, but calls from damfn probably wouldn't like that).

        Acceptance criteria

              Unassigned Unassigned
              breun Nils Breunese
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Task DoD