-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extract more detail from compiler exceptions #262
Conversation
@@ -104,7 +104,7 @@ | |||
[{:keys [class] :as cause}] | |||
(if (= class "clojure.lang.Compiler$CompilerException") | |||
(update-in cause [:message] str/replace | |||
#".* (compiling:)\((.*)\)" "Error $1 $2") | |||
#".*?: (.*?), (compiling:)\((.*)\)" "Error $2 $3 $1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't .*?
the same as .*
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, slightly different [1]. In this case, you would probably be safe with either variation, but I'm being paranoid.
user=> (clojure.string/replace-first "a:b c:d" #"(.*):(.*)" "$1x$2")
"a:b cxd"
user=> (clojure.string/replace-first "a:b c:d" #"(.*?):(.*)" "$1x$2")
"axb c:d"
Looks like all the Travis builds have been failing recently... This commit fails the same part of the build matrix that other recent commits fail. |
This looks good to me. It would be nice to have a test for this, though.
Yes, this is quite embarrassing :/ |
Passing tests added, though Travis is still failing in part of the build matrix. |
Any updates on this PR? I'd love this to be merged in :) |
The commits have to be squashed together. Apart from that it looks ok. |
Commits squashed, though Travis is still failing in part of the build matrix. |
Did you rebase your code on top of the current |
This patch re-introduces the inner 'cause' of compiler exceptions. These exceptions are not always informative, which may be why they were hidden in 0a57231. For example when the compiler is complaining about a syntax error, the exception often refers to a line number far from the actual syntax problem. However, the exceptions can be quite useful, for example when they complain about an undeclared variable. This patch re-introduces this additional detail. I'd be equally happy with completely removing `extract-location`. The output from the two approaches is similar, and perhaps less code is better.
Ah, rebased... tests now passing. |
Extract more detail from compiler exceptions
Thanks @mainej 👍 |
@jeffvalk btw, why did you opt to filter those out? |
This patch re-introduces the inner 'cause' of compiler exceptions.
These exceptions are not always informative, which may be why they were
hidden in 0a57231. For example when the compiler is complaining about
a syntax error, the exception often refers to a line number far from the
actual syntax problem.
However, the exceptions can be quite useful, for example when they
complain about an undeclared variable.
This patch re-introduces this additional detail. I'd be equally happy
with completely removing
extract-location
. The output from the twoapproaches is similar, and perhaps less code is better.