Uploaded image for project: 'Alloy'
  1. Alloy
  2. ALOY-907

JavaScript syntax error output is incorrect and confusing

    Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:

      Alloy 1.3.0
      Titanium SDK 3.2.0
      Appcelerator Studio 3.2.0
      Mac OS X 10.8.5 (Mountain Lion)
      Windows 8 64-bit

      Description

      When building an Alloy app with the following in the index.js controller:

      function doClick(e) {
          alert($.label.text);
      }
       
      $.index.open(){};
      

      Alloy outputs the following error:

      [WARN]  : ERROR: Unexpected token: punc ({) [null:5,14]
      [DEBUG]
      [DEBUG] C:\Users\Thomas Anderson\AppData\Roaming\npm\node_modules\alloy\node_modules\uglify-js\lib\parse.js:199
      [ERROR] (message, line, col, pos);
      [DEBUG]           ^
      [ERROR]
      [ERROR] (C:\Users\Thomas Anderson\AppData\Roaming\npm\node_modules\alloy\node_modules\uglify-js\lib\parse.js:185:18)
      [ERROR] (C:\Users\Thomas Anderson\AppData\Roaming\npm\node_modules\alloy\node_modules\uglify-js\lib\parse.js:199:11)
      [DEBUG]     at croak (C:\Users\Thomas Anderson\AppData\Roaming\npm\node_modules\alloy\node_modules\uglify-js\lib\parse.js:630:9)
      [ERROR] (C:\Users\Thomas Anderson\AppData\Roaming\npm\node_modules\alloy\node_modules\uglify-js\lib\parse.js:638:9)
      [DEBUG]     at unexpected (C:\Users\Thomas Anderson\AppData\Roaming\npm\node_modules\alloy\node_modules\uglify-js\lib\parse.js:644:9)
      [DEBUG]     at semicolon (C:\Users\Thomas Anderson\AppData\Roaming\npm\node_modules\alloy\node_modules\uglify-js\lib\parse.js:664:43)
      [DEBUG]     at simple_statement (C:\Users\Thomas Anderson\AppData\Roaming\npm\node_modules\alloy\node_modules\uglify-js\lib\parse.js:822:73)
      [DEBUG]     at C:\Users\Thomas Anderson\AppData\Roaming\npm\node_modules\alloy\node_modules\uglify-js\lib\parse.js:707:19
      [DEBUG]     at C:\Users\Thomas Anderson\AppData\Roaming\npm\node_modules\alloy\node_modules\uglify-js\lib\parse.js:677:24
      [DEBUG]     at C:\Users\Thomas Anderson\AppData\Roaming\npm\node_modules\alloy\node_modules\uglify-js\lib\parse.js:1395:23
      [ERROR] Alloy compiler failed
      

      There are multiple problems with this output:

      1) The error is printed as a warning
      2) Nowhere does it indicate the actual filename containing the error
      3) It displays the entire stack trace of the Alloy code which is irrelevant to the user's app

      To resolve this, Alloy should:

      1) Show the output as an error, not a warning
      2) Show the filename in which the error is found
      3) Do not show the stack trace
      4) The error should be displayed similar to the Titanium CLI which would look like:

      [ERROR] Failed to minify C:\Users\Thomas Anderson\Documents\Appcelerator_Studio_Workspace\testapp\app\controllers\index.js
      [ERROR] Unexpected token: punc ({) [line 5, column 14]
      [ERROR]   
      [ERROR]     $.index.open(){};
      [ERROR]     --------------^
      [ERROR]
      

        Attachments

          Activity

            People

            • Assignee:
              tlukasavage Tony Lukasavage
              Reporter:
              cbarber Chris Barber
            • Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Integration