Skip to content

Commit

Permalink
Simplified render exceptions
Browse files Browse the repository at this point in the history
* Most errors result in a RuntimeException, there is no need to wrap them
  in another RuntimeException.
  • Loading branch information
pmenhart committed Oct 22, 2019
1 parent 38e5ed3 commit 6b34dc5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/main/java/liqp/Template.java
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,11 @@ public String renderUnguarded(final Map<String, Object> variables) {
return rendered == null ? "" : String.valueOf(rendered);
}
catch (Exception e) {
throw new RuntimeException(e);
if (e instanceof RuntimeException) {
throw e;
} else {
throw new RuntimeException(e);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/liqp/tags/IncludeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public void renderTestWithIncludeSubdirectorySpecifiedInLiquidFlavorWithStrictVa
@Test
public void renderTestWithIncludeSubdirectorySpecifiedInLiquidFlavorWithStrictVariablesException() throws Exception {

thrown.expectCause(new NestedCauseMatcher<>(isA(VariableNotExistException.class)));
thrown.expectCause(isA(VariableNotExistException.class));

File index = new File("src/test/jekyll/index_with_variables.html");
Template template = Template.parse(
Expand Down

0 comments on commit 6b34dc5

Please sign in to comment.