erikras / erikras/react-redux-universal-hot-example

Debugging API errors is impossible, no stack traces

Open
#973 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12.1k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

This is fairly simple to test. Open [`api/actions/index.js`](https://github.com/erikras/react-redux-universal-hot-example/blob/master/api/actions/index.js) and change [this line](https://github.com/erikras/react-redux-universal-hot-example/blob/master/api/actions/index.js#L5) to this syntax:

``` js
export * from './widget/index';
```

So the whole file looks like:

``` js
export loadInfo from './loadInfo';
export loadAuth from './loadAuth';
export login from './login';
export logout from './logout';
export * from './widget/index';
```

`export * from` (instead of the original `export * as x from`) is [valid ES6 syntax](http://www.2ality.com/2014/09/es6-modules-final.html#re-exporting) as far as I can tell. Eslint doesn't complain. However, the API crashes on this line. **There's no relevant stack trace, no relevant files are mentioned,** so it's impossible to debug.

``` prolog
[piping] File api/actions/index.js has changed, reloading.
[piping] can't execute file: bin/api.js
[piping] error given was: SyntaxError: Unexpected reserved word
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:414:25)
at loader (node_modules/babel-register/lib/node.js:128:5)
at Object.require.extensions.(anonymous function) [as .js] (node_modules/babel-register/lib/node.js:138:7)
at Module.load (module.js:356:32)
at Module._load (module.js:311:12)
at Function.module._load (node_modules/piping/lib/launcher.js:32:16)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object. (api/api.js:19:14)
[piping] further repeats of this error will be suppressed...
```

Furthermore, changing other files in the API code trying to debug the error will have no effect on the output, precisely because of "further repeats of this error will be suppressed."

I'm not sure why the valid ES6 syntax crashes the API, but the issue here that has taken up most of my time is trying to track down the source. Without a stack trace, only guess and check is possible.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.