| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -376,15 +376,27 @@ private void ExtractionError(Message msg) | |||
| 376 | 376 | Extractor.Message(msg); | |
| 377 | 377 | } | |
| 378 | 378 | ||
| 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 | + | ||
| 379 | 392 | /// <summary> | |
| 380 | 393 | /// Signal an error in the program model. | |
| 381 | 394 | /// </summary> | |
| 382 | 395 | /// <param name="node">The syntax node causing the failure.</param> | |
| 383 | 396 | /// <param name="msg">The error message.</param> | |
| 384 | 397 | public void ModelError(SyntaxNode node, string msg) | |
| 385 | 398 | { | |
| 386 | - if (!Extractor.Standalone) | ||
| 387 | - throw new InternalError(node, msg); | ||
| 399 | + ReportError(new InternalError(node, msg)); | ||
| 388 | 400 | } | |
| 389 | 401 | ||
| 390 | 402 | /// <summary> | |
@@ -394,8 +406,7 @@ public void ModelError(SyntaxNode node, string msg) | |||
| 394 | 406 | /// <param name="msg">The error message.</param> | |
| 395 | 407 | public void ModelError(ISymbol symbol, string msg) | |
| 396 | 408 | { | |
| 397 | - if (!Extractor.Standalone) | ||
| 398 | - throw new InternalError(symbol, msg); | ||
| 409 | + ReportError(new InternalError(symbol, msg)); | ||
| 399 | 410 | } | |
| 400 | 411 | ||
| 401 | 412 | /// <summary> | |
@@ -404,8 +415,7 @@ public void ModelError(ISymbol symbol, string msg) | |||
| 404 | 415 | /// <param name="msg">The error message.</param> | |
| 405 | 416 | public void ModelError(string msg) | |
| 406 | 417 | { | |
| 407 | - if (!Extractor.Standalone) | ||
| 408 | - throw new InternalError(msg); | ||
| 418 | + ReportError(new InternalError(msg)); | ||
| 409 | 419 | } | |
| 410 | 420 | ||
| 411 | 421 | /// <summary> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,8 +11,13 @@ | |||
| 11 | 11 | import csharp | |
| 12 | 12 | import semmle.code.csharp.commons.Diagnostics | |
| 13 | 13 | ||
| 14 | + private string getLocation(ExtractorError error) { | ||
| 15 | + if error.getLocation().getFile().fromSource() | ||
| 16 | + then result = " in " + error.getLocation().getFile() | ||
| 17 | + else result = "" | ||
| 18 | + } | ||
| 19 | + | ||
| 14 | 20 | from ExtractorError error | |
| 15 | 21 | where not exists(CompilerError ce | ce.getLocation().getFile() = error.getLocation().getFile()) | |
| 16 | 22 | select error, | |
| 17 | - "Unexpected " + error.getOrigin() + " error: " + error.getText() + " in " + | ||
| 18 | - error.getLocation().getFile(), 3 | ||
| 23 | + "Unexpected " + error.getOrigin() + " error" + getLocation(error) + ": " + error.getText(), 3 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,2 @@ | |||
| 1 | + | Program.cs:9:32:9:46 | Unable to resolve target for call. (Compilation error?) | Unexpected C# extractor error in Program.cs: Unable to resolve target for call. (Compilation error?) | 3 | | ||
| 2 | + | file://:0:0:0:0 | Unhandled literal type | Unexpected C# extractor error: Unhandled literal type | 3 | | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments