From eaa22550d5f4c7dfbd4e7cdfec9559feff92b9e8 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Mon, 25 Nov 2019 21:22:30 -0500 Subject: Added appropriate error for missing a var binding The var binding warning before was just a printf(), change it so that it outputs some helpful text to the template's errout. --- src/ctemplates.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ctemplates.c b/src/ctemplates.c index ae2ed2a..3209bf4 100644 --- a/src/ctemplates.c +++ b/src/ctemplates.c @@ -987,8 +987,10 @@ render_variable(struct TMPL_templates* t, struct TMPL_varlist* varlist){ if(t->cursor->TMPL_tag.var.defaultval != NULL){ bputs(t->out,t->cursor->TMPL_tag.var.defaultval); }else{ - printf("Variable not bound, and no default\n"); /*Error, not bound and no default*/ + bputs(t->errout,"Render error: Variable \""); + bputs(t->errout,varname); + bputs(t->errout,"\" was not bound to a value, and has no default\n"); return -1; } }else{ -- cgit v1.2.3-70-g09d2