@@ -376,15 +376,27 @@ private void ExtractionError(Message msg)
376376 Extractor . Message ( msg ) ;
377377 }
378378
379+ private void ExtractionError ( InternalError error )
380+ {
381+ ExtractionError ( new Message ( error . Message , error . EntityText , CreateLocation ( error . Location ) , error . StackTrace , Severity . Error ) ) ;
382+ }
383+
384+ private void ReportError ( InternalError error )
385+ {
386+ if ( ! Extractor . Standalone )
387+ throw error ;
388+
389+ ExtractionError ( error ) ;
390+ }
391+
379392 /// <summary>
380393 /// Signal an error in the program model.
381394 /// </summary>
382395 /// <param name="node">The syntax node causing the failure.</param>
383396 /// <param name="msg">The error message.</param>
384397 public void ModelError ( SyntaxNode node , string msg )
385398 {
386- if ( ! Extractor . Standalone )
387- throw new InternalError ( node , msg ) ;
399+ ReportError ( new InternalError ( node , msg ) ) ;
388400 }
389401
390402 /// <summary>
@@ -394,8 +406,7 @@ public void ModelError(SyntaxNode node, string msg)
394406 /// <param name="msg">The error message.</param>
395407 public void ModelError ( ISymbol symbol , string msg )
396408 {
397- if ( ! Extractor . Standalone )
398- throw new InternalError ( symbol , msg ) ;
409+ ReportError ( new InternalError ( symbol , msg ) ) ;
399410 }
400411
401412 /// <summary>
@@ -404,8 +415,7 @@ public void ModelError(ISymbol symbol, string msg)
404415 /// <param name="msg">The error message.</param>
405416 public void ModelError ( string msg )
406417 {
407- if ( ! Extractor . Standalone )
408- throw new InternalError ( msg ) ;
418+ ReportError ( new InternalError ( msg ) ) ;
409419 }
410420
411421 /// <summary>
0 commit comments