You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by jo...@apache.org on 2019/12/17 20:54:19 UTC

[royale-compiler] 01/02: UnexpectedExceptionProblem: reports the location of the exception in the compiler to make bug fixing easier

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 0389e0f1b47ed06cd295f32c8e9c0c6046677652
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Tue Dec 17 11:35:15 2019 -0800

    UnexpectedExceptionProblem: reports the location of the exception in the compiler to make bug fixing easier
---
 .../apache/royale/compiler/problems/UnexpectedExceptionProblem.java  | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/compiler-common/src/main/java/org/apache/royale/compiler/problems/UnexpectedExceptionProblem.java b/compiler-common/src/main/java/org/apache/royale/compiler/problems/UnexpectedExceptionProblem.java
index 6b9397b..74a7c14 100644
--- a/compiler-common/src/main/java/org/apache/royale/compiler/problems/UnexpectedExceptionProblem.java
+++ b/compiler-common/src/main/java/org/apache/royale/compiler/problems/UnexpectedExceptionProblem.java
@@ -25,7 +25,7 @@ package org.apache.royale.compiler.problems;
 public final class UnexpectedExceptionProblem extends CompilerProblem
 {
     public static final String DESCRIPTION =
-        "Unexpected exception '${exceptionName}'.";
+        "Unexpected exception '${exceptionName}' at ${exceptionLocation}";
 
     public static final int errorCode = 1530;
     
@@ -33,7 +33,10 @@ public final class UnexpectedExceptionProblem extends CompilerProblem
     {
         super();
         this.exceptionName = throwable.getClass().getName();
+        StackTraceElement element = throwable.getStackTrace()[0];
+        this.exceptionLocation = element.getClassName() + "." + element.getMethodName() + ":" + element.getLineNumber();
     }
 
     public final String exceptionName;
+    public final String exceptionLocation;
 }