diff --git a/bin/bunyan b/bin/bunyan index 995a9da8..d9777e23 100755 --- a/bin/bunyan +++ b/bin/bunyan @@ -1069,7 +1069,16 @@ function emitRecord(rec, line, opts, stylize) { rec._cS = stylize.start; // Shortcut for "colorEnd" rec._cE = stylize.end; - emit(opts.template ? opts.template(rec) : 'No template defined. Use --template.' +'\n'); + + var out; + try { + out = opts.template ? opts.template(rec) : 'No template defined. Use --template.'; + } + catch(e) { + // Unprocessable line, display default + return emit(line + '\n'); + } + emit(out + '\n'); break; default: throw new Error('unknown output mode: '+opts.outputMode);