Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19029] Windows: If parsing JS files fails the error message does not contain a reason

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionFixed
Resolution Date2015-06-17T15:11:02.000+0000
Affected Version/sRelease 4.1.0
Fix Version/sRelease 4.1.0
ComponentsWindows
Labelsqe-4.1.0
ReporterEwan Harris
AssigneeKota Iguchi
Created2015-06-15T22:45:28.000+0000
Updated2015-06-23T00:13:42.000+0000

Description

Description

When the CLI is parsing the JS files of an app, if there is a parsing error then it is surfaced as the following
C:\ProgramData\Titanium\mobilesdk\win32\4.1.0.v20150614181235\node_modules\uglify-js\lib\parse.js:197
    throw new JS_Parse_Error(message, line, col, pos);
          ^
Error
    at new JS_Parse_Error (C:\ProgramData\Titanium\mobilesdk\win32\4.1.0.v20150614181235\node_modules\uglify-js\lib\parse.js:189:18)
    at js_error (C:\ProgramData\Titanium\mobilesdk\win32\4.1.0.v20150614181235\node_modules\uglify-js\lib\parse.js:197:11)
    at croak (C:\ProgramData\Titanium\mobilesdk\win32\4.1.0.v20150614181235\node_modules\uglify-js\lib\parse.js:656:9)
    at token_error (C:\ProgramData\Titanium\mobilesdk\win32\4.1.0.v20150614181235\node_modules\uglify-js\lib\parse.js:664:9)
    at expect_token (C:\ProgramData\Titanium\mobilesdk\win32\4.1.0.v20150614181235\node_modules\uglify-js\lib\parse.js:677:9)
    at expect (C:\ProgramData\Titanium\mobilesdk\win32\4.1.0.v20150614181235\node_modules\uglify-js\lib\parse.js:680:36)
    at expr_list (C:\ProgramData\Titanium\mobilesdk\win32\4.1.0.v20150614181235\node_modules\uglify-js\lib\parse.js:1172:44)
    at subscripts (C:\ProgramData\Titanium\mobilesdk\win32\4.1.0.v20150614181235\node_modules\uglify-js\lib\parse.js:1310:30)
    at subscripts (C:\ProgramData\Titanium\mobilesdk\win32\4.1.0.v20150614181235\node_modules\uglify-js\lib\parse.js:1287:20)
    at subscripts (C:\ProgramData\Titanium\mobilesdk\win32\4.1.0.v20150614181235\node_modules\uglify-js\lib\parse.js:1287:20)
When building for Android it will be surfaced as the following
[ERROR] Failed to parse C:\Users\Windo_000\Documents\Appcelerator_Studio_Workspace\testCreate\Resources\app.js
[ERROR] Unexpected token punc «;», expected punc «,» [line 18, column 39]
[ERROR]
[ERROR]      var doc = Ti.XML.parseString(xmlString;
[ERROR]     ---------------------------------------^
[ERROR]

Steps To Reproduce

1. In an existing titanium project edit the app.js so that it will fail the parsing, remove a parentheses for example 2. Build the app for Windows

Actual Result

The parser fails with the first error

Expected Result

The parser should fail with an error indicating the reason why

Comments

  1. Kota Iguchi 2015-06-16

    https://github.com/appcelerator/titanium_mobile_windows/pull/289
  2. Lokesh Choudhary 2015-06-23

    Verified the fix. We not see a reason for parse failure like below:
       [ERROR] :  Failed to parse C:\Users\Steve Ballmer\Documents\Appcelerator_Studio_Workspace\lokiprod\Resources\app.js
       Unexpected token punc «;», expected punc «,» [line 5, column 28]
               throw new Error('oh no!';
           ----------------------------^
       
    Environment: Appc Studio: 4.1.0.201506211738 Ti SDK: 4.1.0.v20150622145911 Ti CLI: 4.0.1 Alloy: 1.6.2 Windows: 8.1 Enterprise 64-bit APPC NPM: 4.1.0-1 APPC CLI: 4.1.0-1 Device: Nokia Lumia 928 - Windows Phone 8.1 Windows Phone Emulator : 8.1.1

JSON Source