private void OnCssError(object sender, CssErrorEventArgs e) { CssException error = e.Exception; if (error.Severity <= WarningLevel) { // 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, "CSS{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})", string.IsNullOrEmpty(FileName) ? "MinifyStyleSheet" : FileName, error.Line, error.Char); AddErrorMessage( location, // not localized string.Empty, // localizable, optional error.Severity < 2, // NOT localized, only two options code, // not localized, cannot contain spaces error.Message); // localizable with optional arguments } }
private void OnCssError(object sender, CssErrorEventArgs e) { ContextError error = e.Error; if (error.Severity <= WarningLevel) { m_errorList.Add(error); } }
void OnCssError(object sender, CssErrorEventArgs e) { CssException error = e.Exception; // ignore severity values greater than our severity level if (error.Severity <= m_warningLevel) { // we found an error m_errorsFound = true; // 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, "CSS{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 context = ((CssParser)sender).FileContext; string location = string.Format( CultureInfo.InvariantCulture, "{0}({1},{2})", (string.IsNullOrEmpty(context) ? "stdin" : context), error.Line, error.Char ); WriteError(CreateBuildError( location, GetSeverityString(error.Severity), (error.Severity < 2), // severity 0 and 1 are errors; rest are warnings code, error.Message )); WriteError(string.Empty); } }
/// <summary> /// Parsing error occured - event handler. /// </summary> private void parser_CssError(object sender, CssErrorEventArgs e) { // Do not minify in the case of parse exception and log the error minificationError = e.Exception; }