@@ -22,17 +22,31 @@ public void addError(String titleMessage, String msg, SourcePosition p, int erro
2222 HashMap <String , PlacementInCode > map ) {
2323 this .titleMessage = titleMessage ;
2424 fullMessage = msg ;
25- position = new ErrorPosition (p .getLine (), p .getColumn (), p .getEndLine (), p .getEndColumn ());
26- filePath = p .getFile ().toURI ();
25+ try {
26+ position = new ErrorPosition (p .getLine (), p .getColumn (), p .getEndLine (), p .getEndColumn ());
27+ filePath = p .getFile ().toURI ();
28+ } catch (Exception ignored ) {
29+ fullMessage = "Seems like this error is created in generated part of source code, so no precise position is provided. "
30+ + fullMessage ;
31+ position = null ;
32+ filePath = null ;
33+ }
2734 this .errorStatus = errorStatus ;
2835 this .map = map ;
2936 }
3037
3138 public void addError (String titleMessage , String msg , SourcePosition p , int errorStatus ) {
3239 this .titleMessage = titleMessage ;
3340 fullMessage = msg ;
34- position = new ErrorPosition (p .getLine (), p .getColumn (), p .getEndLine (), p .getEndColumn ());
35- filePath = p .getFile ().toURI ();
41+ try {
42+ position = new ErrorPosition (p .getLine (), p .getColumn (), p .getEndLine (), p .getEndColumn ());
43+ filePath = p .getFile ().toURI ();
44+ } catch (Exception ignored ) {
45+ fullMessage = "Seems like this error is created in generated part of source code, so no precise position is provided. "
46+ + fullMessage ;
47+ position = null ;
48+ filePath = null ;
49+ }
3650 this .errorStatus = errorStatus ;
3751 }
3852
0 commit comments