Use template for error messages.
Merge pull request #480 from Mchakravartula/issue#321_use_template_for_err_msg

Use template for error messages.