Exemplo n.º 1
0
        private void OnJavaScriptError(object sender, JScriptExceptionEventArgs e)
        {
            ContextError error = e.Error;

            if (error.Severity <= WarningLevel)
            {
                m_errorList.Add(error);
            }
        }
Exemplo n.º 2
0
        private void OnCompilerError(object sender, JScriptExceptionEventArgs e)
        {
            JScriptException error = e.Exception;

            // ignore severity values greater than our severity level
            if (error.Severity <= m_warningLevel)
            {
                // we found an error
                m_errorsFound = true;

                // get the offending line
                string line = error.LineText;

                // get the offending context
                string context = error.ErrorSegment;

                // if the context is empty, use the whole line
                if (context.Length == 0)
                {
                    context = line;
                }

                // the error code is the lower half of the error number, in decimal, prepended with "JS"
                // again, NOT LOCALIZABLE so the format is not in the resources
                string code = string.Format(
                    CultureInfo.InvariantCulture,
                    "JS{0}",
                    (error.Error & (0xffff))
                    );

                // the location is the file name followed by the line and start/end columns within parens.
                // if the file context is empty, use "stdin" as the file name.
                // this string is NOT LOCALIZABLE, so not putting the format in the resources
                string location = string.Format(
                    CultureInfo.InvariantCulture,
                    "{0}({1},{2}-{3})",
                    (string.IsNullOrEmpty(error.FileContext) ? "stdin" : error.FileContext),
                    error.Line,
                    error.StartColumn,
                    error.EndColumn
                    );

                WriteError(CreateBuildError(
                               location,
                               GetSeverityString(error.Severity),
                               (error.Severity < 2),          // severity 0 and 1 are errors; rest are warnings
                               code,
                               error.Message + ": " + context // message, colon, context (which may be the entire line)
                               ));
                // Error;;{0}: {1}
                //WriteError(StringMgr.GetString("ErrorLine1", GetSeverityString(error.Severity), error.Message));
                // ;;At line {0}, col {1}-{2}: {3}
                //WriteError(StringMgr.GetString("ErrorLine2", error.Line, error.StartColumn, error.EndColumn, context));
                WriteError(string.Empty);
            }
        }
Exemplo n.º 3
0
        private void OnJavaScriptError(object sender, JScriptExceptionEventArgs e)
        {
            JScriptException error = e.Exception;

            // ignore severity values greater than our severity level
            if (error.Severity <= WarningLevel)
            {
                // get the offending line
                string line = error.LineText;

                // get the offending context
                string context = error.ErrorSegment;

                // if the context is empty, use the whole line
                if (context.Length == 0)
                {
                    context = line;
                }

                // the error code is the lower half of the error number, in decimal, prepended with "JS"
                // again, NOT LOCALIZABLE so the format is not in the resources
                string code = string.Format(
                    CultureInfo.InvariantCulture,
                    "JS{0}",
                    error.Error & 0xffff);

                // the location is the file name followed by the line and start/end columns within parens.
                // if the file context is empty, use "stdin" as the file name.
                // this string is NOT LOCALIZABLE, so not putting the format in the resources
                string location = string.Format(
                    CultureInfo.InvariantCulture,
                    "{0}({1},{2}-{3})",
                    string.IsNullOrEmpty(FileName) ? "MinifyJavaScript" : FileName,
                    error.Line,
                    error.StartColumn,
                    error.EndColumn);

                AddErrorMessage(
                    location,                        // not localized
                    string.Empty,                    // localizable, optional
                    error.Severity < 2,              // NOT localized, only two options
                    code,                            // not localized, cannot contain spaces
                    error.Message + ": " + context); // localizable with optional arguments
            }
        }
Exemplo n.º 4
0
 private void OnScriptError(object sender, JScriptExceptionEventArgs ea)
 {
     ReportError(0, StringEnum.ExpressionError, ea.Error.Message);
     m_expressionContainsErrors = true;
 }
 private void parser_CompilerError(object sender, JScriptExceptionEventArgs e)
 {
     // Store exception and info if the compiler can recover
     minificationError = e.Exception;
     canRecover = e.Exception.CanRecover;
 }
 private void OnJavaScriptError(object sender, JScriptExceptionEventArgs e)
 {
     ContextError error = e.Error;
     if (error.Severity <= WarningLevel)
     {
         m_errorList.Add(error);
     }
 }
Exemplo n.º 7
0
 void OnCompilerError(object sender, JScriptExceptionEventArgs ex)
 {
     // add it to the list and keep on truckin'
     m_errorList.Add(ex.Exception);
 }