Catch the error if building template is failed.