Print out reasonable error rather throwing undefined type error closure
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Fri, 23 May 2014 11:44:38 +0200
branchclosure
changeset 1589b66d6e7756bb
parent 1588 c1b6db1bdd87
child 1590 8eeb682738f0
Print out reasonable error rather throwing undefined type error
rt/vm/src/main/java/org/apidesign/vm4brwsr/VM.java
     1.1 --- a/rt/vm/src/main/java/org/apidesign/vm4brwsr/VM.java	Thu May 22 22:32:00 2014 +0200
     1.2 +++ b/rt/vm/src/main/java/org/apidesign/vm4brwsr/VM.java	Fri May 23 11:44:38 2014 +0200
     1.3 @@ -526,8 +526,12 @@
     1.4                  + "        var at = args[i];\n"
     1.5                  + "        var ret;\n"
     1.6                  + "        if (typeof at === 'function') ret = at(name, skip);\n"
     1.7 -                + "        else ret = vm['org_apidesign_vm4brwsr_ClassPath'](false).\n"
     1.8 -                + "          loadBytes___3BLjava_lang_String_2Ljava_lang_Object_2II(name, args, i, skip);\n"
     1.9 +                + "        else {\n"
    1.10 +                + "          var cp = vm['org_apidesign_vm4brwsr_ClassPath'];\n"
    1.11 +                + "          if (!cp) throw 'Core Java library not registered. Cannot load from ' + at;\n"
    1.12 +                + "          ret = cp(false).\n"
    1.13 +                + "            loadBytes___3BLjava_lang_String_2Ljava_lang_Object_2II(name, args, i, skip);\n"
    1.14 +                + "        }\n"
    1.15                  + "        if (ret !== null) return ret;\n"
    1.16                  + "      }\n"
    1.17                  + "      while (knownExtensions < extensions.length) {\n"