/// <summary>
        /// Initialize
        /// </summary>
        /// <param name="errors"></param>
        public CompilerException(CompilerErrorCollection errors)
            : base(GetErrorMessages(errors))
        {
            Expect.IsNotNull(errors, nameof(errors));

            Errors = errors.OfType <CompilerError>().ToArray();
        }
        internal static CompileException Get(string stackTrace, string source, Dictionary <string, object> parms, CompilerErrorCollection errors)
        {
            CompileException ex = null;

            foreach (var e in errors.OfType <CompilerError>())
            {
                var message = string.Format("[{0}:{1}] ({2}) {3}", e.Line, e.Column, e.ErrorNumber, e.ErrorText);
                var n       = new CompileException(message, stackTrace, source, parms, ex);
                ex = n;
            }
            return(ex);
        }
 private static string GetErrorMessages(CompilerErrorCollection errors)
 {
     return(string.Join(Environment.NewLine, errors.OfType <CompilerError>()
                        .Select(GetErrorMessage)));
 }