ClojureScript

Include line and file information in error messages

Details

  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Patch:
    Code

Description

Just as the ana/warning function did, now errors and assertions include line and file source information. I needed this sorely.

  1. CLJS-432-v001.patch
    28/Nov/12 5:48 PM
    15 kB
    Brandon Bloom
  2. CLJS-432-v002.patch
    28/Nov/12 6:13 PM
    6 kB
    Brandon Bloom
  3. CLJS-432-v003.patch
    29/Nov/12 2:28 PM
    6 kB
    Brandon Bloom
  4. CLJS-432-v004.patch
    29/Nov/12 2:50 PM
    2 kB
    Brandon Bloom
  5. CLJS-432-v005.patch
    29/Nov/12 2:57 PM
    2 kB
    Brandon Bloom
  6. CLJS-432-v006.patch
    29/Nov/12 5:05 PM
    4 kB
    Brandon Bloom

Activity

Brandon Bloom made changes -
Field Original Value New Value
Attachment CLJS-432-v001.patch [ 11721 ]
Hide
Brandon Bloom added a comment -

Added v2 of patch that will handle any exception during parsing. Similar could be done during code generation. This approach seems much more robust and less invasive.

Show
Brandon Bloom added a comment - Added v2 of patch that will handle any exception during parsing. Similar could be done during code generation. This approach seems much more robust and less invasive.
Brandon Bloom made changes -
Attachment CLJS-432-v002.patch [ 11722 ]
Hide
Brandon Bloom added a comment -

That v2 was made hastily. Upon further thought, it seems broken in the face of recursive analysis. I think the right thing, if we prefer the exception catching approach, is to rethrow as a custom exception type, which would be allowed through un-re-wrapped.

For example:

(try
  (parse-form ...)
  (catch AnalysisError e
    throw e)
  (catch Throwable e
    (throw (AnalysisError. env e))))
Show
Brandon Bloom added a comment - That v2 was made hastily. Upon further thought, it seems broken in the face of recursive analysis. I think the right thing, if we prefer the exception catching approach, is to rethrow as a custom exception type, which would be allowed through un-re-wrapped. For example:
(try
  (parse-form ...)
  (catch AnalysisError e
    throw e)
  (catch Throwable e
    (throw (AnalysisError. env e))))
Hide
David Nolen added a comment -

I don't have a problem with the approach in the first patch. I don't really see how a less invasive patch is even possible - you still need to pass the environment to some assertion check if you are going to throw a custom exception as well.

Show
David Nolen added a comment - I don't have a problem with the approach in the first patch. I don't really see how a less invasive patch is even possible - you still need to pass the environment to some assertion check if you are going to throw a custom exception as well.
Hide
Brandon Bloom added a comment -

v3 of patch fixes issue with v2

Show
Brandon Bloom added a comment - v3 of patch fixes issue with v2
Brandon Bloom made changes -
Attachment CLJS-432-v003.patch [ 11727 ]
Hide
Brandon Bloom added a comment -

v4 of patch as discussed in irc

Show
Brandon Bloom added a comment - v4 of patch as discussed in irc
Brandon Bloom made changes -
Attachment CLJS-432-v004.patch [ 11728 ]
Hide
Brandon Bloom added a comment -

v5 also catches error from parse-invoke

Show
Brandon Bloom added a comment - v5 also catches error from parse-invoke
Brandon Bloom made changes -
Attachment CLJS-432-v005.patch [ 11730 ]
Hide
Brandon Bloom added a comment -

v6 improves errors in repl as discussed in IRC

Show
Brandon Bloom added a comment - v6 improves errors in repl as discussed in IRC
Brandon Bloom made changes -
Attachment CLJS-432-v006.patch [ 11732 ]
David Nolen made changes -
Resolution Completed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]
David Nolen made changes -
Status Resolved [ 5 ] Closed [ 6 ]

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: