Closed Bug 1507936 Opened 6 years ago Closed 6 years ago

build syntax errors are confusing

Categories

(DevTools :: Debugger, task, P3)

task

Tracking

(firefox70 fixed)

RESOLVED FIXED
Firefox 70
Tracking Status
firefox70 --- fixed

People

(Reporter: jlast, Assigned: davidwalsh)

References

(Blocks 1 open bug)

Details

(Whiteboard: [debugger-mvp])

Attachments

(1 file)

When a debugger source has a syntax error the build output is pretty confusing... It would be better if we catch the error and output a more useful exception. > 0:02.09 Elapsed: 0.01s; From /Users/jlaster/src/moz/gecko-dev/objdir-frontend-artifacts/dist/bin/localization: Kept 0 existing; Added/updated 12; Removed 0 files and 0 directories. > 0:02.11 /Users/jlaster/src/moz/gecko-dev/devtools/client/debugger/new/build/babel.js:2 > 0:02.11 pluginUnknown:"Unknown plugin $1 specified in $2 at $3, attempted to resolve relative to $4",pluginInvalidProperty:"Plugin $2 specified in $1 provided an invalid property of $3"}},function(e,t,r){"use strict";var n=r(16);e.exports=function(e){if(!n(e))throw TypeError(e+" is not an object!");return e}},function(e,t,r){"use strict";e.exports=!r(27)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,r){"use strict";var n=r(21),i=r(231),s=r(154),a=Object.defineProperty;t.f=r(22)?Object.defineProperty:function(e,t,r){if(n(e),t=s(t,!0),n(r),i)try{return a(e,t,r)}catch(e){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(e[t]=r.value),e}},function(e,t,r){"use strict";function n(e){return null!=e&&s(e.length)&&!i(e)}var i=r(175),s=r(176);e.exports=n},function(e,t){"use strict";function r(e){return null!=e&&"object"==(void 0===e?"undefined":n(e))}var n="fu > 0:02.11 SyntaxError: unknown: 'import' and 'export' may only appear at the top level (173:0) > 0:02.11 171 | * @static > 0:02.11 172 | */ > 0:02.11 > 173 | export function newSource(source: Source) { > 0:02.11 | ^ > 0:02.11 174 | return async ({ dispatch }: ThunkArgs) => { > 0:02.11 175 | await dispatch(newSources([source])); > 0:02.11 176 | }; > 0:02.11 at t.J.raise (/Users/jlaster/src/moz/gecko-dev/devtools/client/debugger/new/build/babel.js:7:10099) > 0:02.11 at t.z.parseStatement (/Users/jlaster/src/moz/gecko-dev/devtools/client/debugger/new/build/babel.js:5:29335) > 0:02.11 at t.parseStatement (/Users/jlaster/src/moz/gecko-dev/devtools/client/debugger/new/build/babel.js:8:3541) > 0:02.11 at t.z.parseBlockBody (/Users/jlaster/src/moz/gecko-dev/devtools/client/debugger/new/build/babel.js:6:4425) > 0:02.11 at t.z.parseBlock (/Users/jlaster/src/moz/gecko-dev/devtools/client/debugger/new/build/babel.js:6:4035) > 0:02.12 at te.parseFunctionBody (/Users/jlaster/src/moz/gecko-dev/devtools/client/debugger/new/build/babel.js:7:7050) > 0:02.12 at t.parseFunctionBody (/Users/jlaster/src/moz/gecko-dev/devtools/client/debugger/new/build/babel.js:8:3312) > 0:02.12 at t.z.parseFunction (/Users/jlaster/src/moz/gecko-dev/devtools/client/debugger/new/build/babel.js:6:6362) > 0:02.12 at t.z.parseFunctionStatement (/Users/jlaster/src/moz/gecko-dev/devtools/client/debugger/new/build/babel.js:6:441) > 0:02.12 at t.z.parseStatement (/Users/jlaster/src/moz/gecko-dev/devtools/client/debugger/new/build/babel.js:5:28567) > 0:02.12 Failed with Command '[u'/Users/jlaster/.mozbuild/node/bin/node', '/Users/jlaster/src/moz/gecko-dev/devtools/client/debugger/new/build/copy-module.js', '/Users/jlaster/src/moz/gecko-dev/devtools/client/debugger/new/src/actions/sources/blackbox.js', '/Users/jlaster/src/moz/gecko-dev/devtools/client/debugger/new/src/actions/sources/index.js', '/Users/jlaster/src/moz/gecko-dev/devtools/client/debugger/new/src/actions/sources/loadSourceText.js', '/Users/jlaster/src/moz/gecko-dev/devtools/client/debugger/new/src/actions/sources/newSources.js', '/Users/jlaster/src/moz/gecko-dev/devtools/client/debugger/new/src/actions/sources/prettyPrint.js', '/Users/jlaster/src/moz/gecko-dev/devtools/client/debugger/new/src/actions/sources/select.js']' returned non-zero exit status 1. Be sure to check that your mozconfig doesn't > 0:02.12 have --disable-nodejs in it. If it does, try removing that line and > 0:02.12 building again. > 0:02.13 make[1]: *** [.deps/node.stub.stub] Error 1 > 0:02.13 make: *** [/Users/jlaster/src/moz/gecko-dev/objdir-frontend-artifacts/devtools/client/debugger/new/src/actions/sources/node.stub] Error 2 > 0:02.13 make: *** Waiting for unfinished jobs....
Priority: -- → P3
Blocks: dbg-node-build
No longer blocks: node-dx
No longer blocks: dbg-node-build
Blocks: node-dx
Type: enhancement → task
Blocks: dbg-70
Whiteboard: [debugger-reserve]

Jason: Do you have a specific pattern you’d like to see? This seems reasonable to me — it provides every bit of information we need to know what needs fixing.

Flags: needinfo?(jlaster)

Yep, should have had more information here:

  1. we should report which file failed as opposed to the list of files in the directory
  2. we should print the specific failure, in this case:
> 0:02.11 SyntaxError: unknown: 'import' and 'export' may only appear at the top level (173:0)
> 0:02.11   171 |  * @static
> 0:02.11   172 |  */
> 0:02.11 > 173 | export function newSource(source: Source) {
> 0:02.11       | ^
> 0:02.11   174 |   return async ({ dispatch }: ThunkArgs) => {
> 0:02.11   175 |     await dispatch(newSources([source]));
> 0:02.11   176 |   };

We can do this by adding a try/catch in the build function which will tell us which file failed and printing the error message (i think).

Flags: needinfo?(jlaster)
Assignee: nobody → dwalsh
Status: NEW → ASSIGNED
Whiteboard: [debugger-reserve] → [debugger-mvp]
Pushed by dwalsh@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/799bd24598d3 Provide information when node compilation fails r=jlast
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 70
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: