babel es6 wrong exception location with react
<p>i think this is a babel problem (not completely sure).  The errors my javascript console throws are always wrong...  No matter where the error occurs in my code it points to my handleFailure(serviceName, error) block...   for instance... Calling this.foo(); after hand success occurs or even in i move this.foo(); to my getItemById method.. it always throws an error in the same block...  What am i doing wrong in my store....</p>

<p>if i remove the bogus code it works just fine...  i would like the error shown to me to reference the bogus code..</p>

<p><strong>this is the error:</strong>
    AircraftLocationStore.js:40 Server call aircraftLocationRest failed with error: aircraftLocationRest!handleFailure @ AircraftLocationStore.js:40(anonymous function) @ RestServiceClient.js:20</p>

<pre><code>class AircraftLocationStore extends EventEmitter {
    constructor() {
        super();
        this._populateRestCallStatus = RestCallStatus.NOT_REQUESTED;
        this._dataStore = Map({});
        this.handleSuccess = this.handleSuccess.bind(this);
        this.handleFailure = this.handleFailure.bind(this);
    }
    populate(){
        RestService.fetchData(this.handleSuccess, this.handleFailure, 'aircraftLocationRest');
        this._populateRestCallStatus = RestCallStatus.STARTED
    }

    handleSuccess(serviceName, jsonData){
        UT.logMethod(TAG, `${serviceName} succeeded!`)
        jsonData.forEach((entity) =&gt; {
            let tempEntity = AircraftLocationHelper.createFromJson(entity);
            this._dataStore = this._dataStore.merge(Map.of(tempEntity.id, tempEntity))
        });
        UT.log('isMap', Map.isMap(this._dataStore))
        this.foo();
        this._populateRestCallStatus = RestCallStatus.SUCCESS;
        this.emitChange();
    }

    handleFailure(serviceName, error){
        //Utils.logMethod(TAG, 'handleFailure');
        this._populateRestCallStatus = RestCallStatus.FAILED
        console.error(`Server call ${serviceName} failed with error: ${serviceName}!`)
    }

  ...

export default new AircraftLocationStore();
</code></pre>

<p>if i try and change an immutablejs record on my display component in the onChange it tells me this...</p>

<p>just in case i will include the code that handles the callback that ALWAYS throws the error</p>

<pre><code>class RestServiceClient{

    /**
     * @param successCB
     * @param failureCB
     * @param endPoint
     */
    fetchData(successCB, failureCB, endPoint) {
        const serverUrl = BASE_URL + endPoint;
        UT.log('serverUrl', serverUrl);
        fetch(serverUrl).then(r =&gt; r.json())
            .then(data =&gt; successCB(endPoint, data))
            .catch(e =&gt; failureCB(endPoint, e.toString()))
    }
}
export default new RestServiceClient();
</code></pre>

<p>here is my webpack.config</p>

<pre><code>var path = require('path');
var webpack = require('webpack');

module.exports = {
  devtool: "source-map",
  entry: "./src/index.js",
  output: {
    path: __dirname + "/build",
    filename: "bundle.js"
  },

    module: {
        loaders: [{
            test: /\.js$/,
            loaders: ['react-hot', 'babel'],
            include: path.join(__dirname, 'src'),
            exclude: /node_modules/
        }]
    }
};
</code></pre>