Skip to content

Commit

Permalink
v3.14.4 release (^.^)YYa!!
Browse files Browse the repository at this point in the history
  • Loading branch information
yangfuhai committed Apr 7, 2022
1 parent d60c6af commit e777a57
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions src/main/java/io/jboot/web/render/TemplateErrorRender.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,32 @@
*/
package io.jboot.web.render;

import com.jfinal.render.TextRender;
import com.jfinal.render.Render;
import com.jfinal.render.RenderException;
import com.jfinal.template.TemplateException;

public class TemplateErrorRender extends TextRender {
import java.io.IOException;
import java.io.PrintWriter;

public class TemplateErrorRender extends Render {

private final TemplateException exception;

public TemplateErrorRender(TemplateException e) {
super(e.getMessage());
this.exception = e;
}

@Override
public void render() {
try {
PrintWriter writer = response.getWriter();
String message = exception.getMessage();
if (message != null) {
message = message.replace("\n", "<br />");
}
writer.write("TemplateException: " + message);
} catch (IOException e) {
throw new RenderException(e);
}
}
}

0 comments on commit e777a57

Please sign in to comment.