@@ -274,21 +274,19 @@ private void AnalyzeFile(string filePath)
274274 ErrorCategory . InvalidArgument , filePath ) ) ;
275275 }
276276
277- if ( errors != null && errors . Length > 0 )
277+ if ( errors != null && errors . Length > 0 )
278278 {
279279 foreach ( ParseError error in errors )
280280 {
281- WriteError ( new ErrorRecord ( new ParseException ( ) ,
282- String . Format ( CultureInfo . CurrentCulture , Strings . ParserErrorFormat , error . Extent . File , error . Message . TrimEnd ( '.' ) , error . Extent . StartLineNumber , error . Extent . StartColumnNumber ) ,
283- ErrorCategory . ParserError , error . ErrorId ) ) ;
281+ string parseErrorMessage = String . Format ( CultureInfo . CurrentCulture , Strings . ParserErrorFormat , error . Extent . File , error . Message . TrimEnd ( '.' ) , error . Extent . StartLineNumber , error . Extent . StartColumnNumber ) ;
282+ WriteError ( new ErrorRecord ( new ParseException ( parseErrorMessage ) , parseErrorMessage , ErrorCategory . ParserError , error . ErrorId ) ) ;
284283 }
285284 }
286285
287286 if ( errors . Length > 10 )
288287 {
289- WriteError ( new ErrorRecord ( new ParseException ( ) ,
290- String . Format ( CultureInfo . CurrentCulture , Strings . ParserErrorMessage , System . IO . Path . GetFileName ( filePath ) ) ,
291- ErrorCategory . ParserError , filePath ) ) ;
288+ string manyParseErrorMessage = String . Format ( CultureInfo . CurrentCulture , Strings . ParserErrorMessage , System . IO . Path . GetFileName ( filePath ) ) ;
289+ WriteError ( new ErrorRecord ( new ParseException ( manyParseErrorMessage ) , manyParseErrorMessage , ErrorCategory . ParserError , filePath ) ) ;
292290
293291 return ;
294292 }
0 commit comments