try {
writer = new OutputStreamWriter(output, charset);
writeTemplate(writer);
} catch (IOException e) {
error("Rendering Error: " + this.template.templateName, e);
throw new RenderException(e);
} catch (PirkaRuntimeException e) {
error("Rendering Error: " + this.template.templateName, e);
throw e;
} catch (RuntimeException e) {
error("Rendering Error: " + this.template.templateName, e);
throw new RenderException(e);
} finally {
if (writer != null) {
try {
writer.close();
} catch (IOException e) {