/// <summary> /// Initialises a new instance of <see cref="TemplateCompilationException"/>. /// </summary> /// <param name="errors">The set of compiler errors.</param> /// <param name="files">The source code that wasn't compiled.</param> /// <param name="template">The source template that wasn't compiled.</param> public TemplateCompilationException(IEnumerable <RazorEngineCompilerError> errors, CompilationData files, ITemplateSource template) : base(TemplateCompilationException.GetMessage(errors, files, template)) { var list = errors.ToList(); CompilerErrors = new ReadOnlyCollection <RazorEngineCompilerError>(list); CompilationData = files; Template = template.Template; }
/// <summary> /// Initialises a new instance of <see cref="TemplateCompilationException"/>. /// </summary> /// <param name="errors">The set of compiler errors.</param> /// <param name="sourceCode">The source code that wasn't compiled.</param> /// <param name="template">The source template that wasn't compiled.</param> internal TemplateCompilationException(CompilerErrorCollection errors, string sourceCode, string template) : base(TemplateCompilationException.GetMessage(errors, sourceCode, template)) { var list = errors.Cast <CompilerError>().ToList(); Errors = new ReadOnlyCollection <CompilerError>(list); SourceCode = sourceCode; Template = template; }