refactored template.write
reject a new error object not a string