Ignore:
Timestamp:
2009-07-02 15:06:52 (3 years ago)
Author:
bruno
Message:

Introduce a TemplateException? class, and use that in the template code instead of a generic RuntimeException?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/universe/kauri-template/src/main/java/org/kauriproject/template/DefaultTemplateBuilder.java

    r1344 r1346  
    139139            xmlReader.parse(is); 
    140140        } catch (Exception ex) { 
    141             throw new RuntimeException("Error parsing template file " + source.getReference(), ex); 
     141            throw new TemplateException("Error parsing template file " + source.getReference(), ex); 
    142142        } finally { 
    143143            IOUtils.closeQuietly(in); 
     
    160160            parser = factory.newSAXParser(); 
    161161        } catch (SAXException saxex) { 
    162             log.error(saxex); 
     162            throw new TemplateException(saxex); 
    163163        } catch (ParserConfigurationException parsex) { 
    164             log.error(parsex); 
     164            throw new TemplateException(parsex); 
    165165        } 
    166166        return parser; 
     
    396396                        blocksPushed++; 
    397397                        if (macroRegistry.containsKey(macroblock.getName())) { 
    398                             throw new RuntimeException("A macro with name " + macroblock.getName() 
     398                            throw new TemplateException("A macro with name " + macroblock.getName() 
    399399                                    + " is already defined, location " 
    400400                                    + macroblock.getStartStep().getLocation()); 
     
    417417 
    418418                        if (parentBlock == null) { 
    419                             throw new RuntimeException( 
     419                            throw new TemplateException( 
    420420                                    "Parameter must appear as a direct child in a macro or callMacro element, location " 
    421421                                            + parameterblock.getStartStep().getLocation()); 
     
    435435                        blocksPushed++; 
    436436                        if (inheritanceRegistry.containsKey(inheritblock.getName())) { 
    437                             throw new RuntimeException("A block with name " + inheritblock.getName() 
     437                            throw new TemplateException("A block with name " + inheritblock.getName() 
    438438                                    + " is already defined, location " 
    439439                                    + inheritblock.getStartStep().getLocation()); 
     
    445445                                attributes), parent); 
    446446                        if (parent == null) { 
    447                             throw new RuntimeException( 
     447                            throw new TemplateException( 
    448448                                    "A call to a superBlock is only possible from within an overriding block, location " 
    449449                                            + superblock.getStartStep().getLocation()); 
Note: See TracChangeset for help on using the changeset viewer.