Author: radu
Date: Wed Sep  2 13:33:49 2015
New Revision: 1700813

URL: http://svn.apache.org/r1700813
Log:
SLING-4754 - Improve error message if referenced resource type is not available

Modified:
    
sling/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/UnitLoader.java

Modified: 
sling/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/UnitLoader.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/UnitLoader.java?rev=1700813&r1=1700812&r2=1700813&view=diff
==============================================================================
--- 
sling/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/UnitLoader.java
 (original)
+++ 
sling/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/UnitLoader.java
 Wed Sep  2 13:33:49 2015
@@ -130,6 +130,7 @@ public class UnitLoader {
                 scriptSource = 
IOUtils.toString(scriptResource.adaptTo(InputStream.class), encoding);
                 return obtainResultSource(scriptSource, identifier, bindings, 
renderContext);
             }
+            throw new SightlyException("Cannot find template " + 
identifier.getResource().getPath() + " in the repository.");
         } catch (SightlyParsingException e) {
             String offendingInput = e.getOffendingInput();
             if (StringUtils.isNotEmpty(offendingInput)) {
@@ -141,9 +142,8 @@ public class UnitLoader {
                 throw e;
             }
         } catch (IOException e) {
-            throw new SightlyException(e);
+            throw new SightlyException("Unable to read the contents of " + 
identifier.getResource().getPath(), e);
         }
-        throw new SightlyException("Unable to generate Java class for template 
" + identifier.getResource().getPath());
     }
 
     private String obtainResultSource(String scriptSource, SourceIdentifier 
identifier, Bindings bindings, RenderContextImpl renderContext) {


Reply via email to