This is an automated email from the ASF dual-hosted git repository.

joshtynjala pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git

commit 6fd5837f22f36de14f59726e9c9d6d6e26e0bdbb
Author: Josh Tynjala <[email protected]>
AuthorDate: Thu Oct 31 10:36:42 2024 -0700

    formatter: include file path in exception message
---
 .../src/main/java/org/apache/royale/formatter/ASTokenFormatter.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/formatter/src/main/java/org/apache/royale/formatter/ASTokenFormatter.java 
b/formatter/src/main/java/org/apache/royale/formatter/ASTokenFormatter.java
index 976f7a085..259379655 100644
--- a/formatter/src/main/java/org/apache/royale/formatter/ASTokenFormatter.java
+++ b/formatter/src/main/java/org/apache/royale/formatter/ASTokenFormatter.java
@@ -181,7 +181,7 @@ public class ASTokenFormatter extends BaseTokenFormatter {
 
                List<IASToken> tokens = 
insertExtraAS3Tokens(repairedTokensList, text);
                try {
-                       return parseTokens(tokens, text);
+                       return parseTokens(tokens, text, filePath);
                } catch (Exception e) {
                        if (problems != null) {
                                System.err.println(e);
@@ -192,7 +192,7 @@ public class ASTokenFormatter extends BaseTokenFormatter {
                }
        }
 
-       private String parseTokens(List<IASToken> tokens, String fileText) 
throws Exception {
+       private String parseTokens(List<IASToken> tokens, String fileText, 
String filePath) throws Exception {
                indent = 0;
                inCaseOrDefaultClause = false;
                inControlFlowStatement = false;
@@ -1074,7 +1074,7 @@ public class ASTokenFormatter extends BaseTokenFormatter {
                        }
                }
                if (blockStack.size() > 0) {
-                       throw new Exception("Unexpected end of file. Blocks 
still considered open by formatter. This is a bug.");
+                       throw new Exception("Unexpected end of file <" + 
filePath + ">. Blocks still considered open by formatter. This is a bug.");
                }
                return builder.toString();
        }

Reply via email to