ClojureScript

error__GT_str not defined for cli scripts

Details

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

Description

If you evaluate this (where the SHA 950032dba300451835c4c7c2a0c1c74ca6d0b49a is master as of January 25, 2019):

clj -Sdeps '{:deps {org.clojure/clojurescript {:git/url "https://github.com/clojure/clojurescript" :sha "950032dba300451835c4c7c2a0c1c74ca6d0b49a"}}}' -m cljs.main -re node -e js/foo

you will get an error Cannot read property 'error__GT_str' of undefined (and the process will fail to terminate).

This is a regression; if you do this

clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "1.10.439"}}}' -m cljs.main -re node -e js/foo

you will get a proper failure regarding foo not being defined.

An analogous error occurs for -re nashorn.

Activity

Hide
Mike Fikes added a comment -

Similar to CLJS-3022

Show
Mike Fikes added a comment - Similar to CLJS-3022
Hide
Mike Fikes added a comment -

There may be other interesting test cases in CLJ-2463

Show
Mike Fikes added a comment - There may be other interesting test cases in CLJ-2463
Hide
Mike Fikes added a comment - - edited

The reason error->str is defined for regular REPL use is only because cljs.repl is in the default REPL-requires. CLJS-3043.patch addresses this by explicitly loading cljs.repl for non-REPL launches (it puts it in cljs.cli/default-main). And, it puts it early in default-main so that if any of the subsequent evaluations fail, error->str is available.

This works. One negative consequence is that it always loads cljs.repl even when it may not be needed. But, on this subject, perhaps one relevant idea to ponder is CLJS-3014.

Show
Mike Fikes added a comment - - edited The reason error->str is defined for regular REPL use is only because cljs.repl is in the default REPL-requires. CLJS-3043.patch addresses this by explicitly loading cljs.repl for non-REPL launches (it puts it in cljs.cli/default-main). And, it puts it early in default-main so that if any of the subsequent evaluations fail, error->str is available. This works. One negative consequence is that it always loads cljs.repl even when it may not be needed. But, on this subject, perhaps one relevant idea to ponder is CLJS-3014.
Hide
Mike Fikes added a comment - - edited

CLJS-3043.patch fails CI, exhibiting separate issue CLJS-3045

Show
Mike Fikes added a comment - - edited CLJS-3043.patch fails CI, exhibiting separate issue CLJS-3045
Hide
Mike Fikes added a comment -

CLJS-3043-2.patch excludes Rhino

CLJS-3043-2.patch passes CI

Show
Mike Fikes added a comment - CLJS-3043-2.patch excludes Rhino CLJS-3043-2.patch passes CI

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: