com.hubspot.jinjava.interpret.FatalTemplateErrorsException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jinjava Show documentation
Show all versions of jinjava Show documentation
Jinja templating engine implemented in Java
package com.hubspot.jinjava.interpret;
import java.util.Collection;
/**
* Container exception thrown when fatal errors are encountered while rendering a template.
*
* @author jstehler
*/
public class FatalTemplateErrorsException extends InterpretException {
private static final long serialVersionUID = 1L;
private final String template;
private final Iterable errors;
public FatalTemplateErrorsException(String template, Collection errors) {
super(generateMessage(errors));
this.template = template;
this.errors = errors;
}
private static String generateMessage(Collection errors) {
if (errors.isEmpty()) {
throw new IllegalArgumentException("FatalTemplateErrorsException should have at least one error");
}
return errors.iterator().next().getMessage();
}
public String getTemplate() {
return template;
}
public Iterable getErrors() {
return errors;
}
}