AmpersandJS / ampersand-sync

Provides sync behavior for updating data from ampersand models and collections to the server.
http://ampersandjs.com
MIT License
20 stars 28 forks source link

XHR2 not sending err.message in it's failure response, assumed to be there. #50

Closed EvanCarroll closed 9 years ago

EvanCarroll commented 9 years ago

In the XHR2 branch, getting the following

     Uncaught TypeError: Cannot read property 'message' of null
      at Request._callback (/home/ecarroll/code/samp/node_modules/ampersand-model/node_modules/ampersand-sync/core.js:114:73)
      at Request.self.callback (/home/ecarroll/code/samp/node_modules/ampersand-model/node_modules/ampersand-sync/node_modules/request/request.js:354:22)

The conditionals are wrong. Patch attached.

EvanCarroll commented 9 years ago

Pull request.. https://github.com/AmpersandJS/ampersand-sync/pull/51

naugtur commented 9 years ago

It seems to me that the PR is doing far too much. Let me commit a fix to this issue that I think will suffice.

naugtur commented 9 years ago

try with https://github.com/AmpersandJS/ampersand-sync/commit/95ec785aa11632af8acc666f0ef60394c69473be

I believe it addresses this issue and #52

EvanCarroll commented 9 years ago

It doesn't address #52, #52 was explicitly about returning the error as a javascript object if the body was JSON.