throw or detect null value

25 views
Skip to first unread message

Rob Shepherd

unread,
Feb 25, 2016, 7:02:29 PM2/25/16
to handlebars.java
Hi,

I want to be able to either throw an exception or raise a warning if a variable has resolved to null (and rendered empty)

Is this possible?

Thanks

Rob

edgar

unread,
Feb 26, 2016, 8:13:24 AM2/26/16
to handlebars.java
Hi,

 Try:

handlebars.registerHelperMissing(new Helper<Object>() {
 
public CharSequence apply(Object value, Options options){
   
throw new IllegalStateException("No value for " + options.helperName);
 
}

Thanks
Reply all
Reply to author
Forward
0 new messages