mikehostetler / amplify

AmplifyJS
http://amplifyjs.com
GNU General Public License v2.0
1.45k stars 143 forks source link

Throw an exception when data returned to does not conform to jsend #60

Closed brianmhunt closed 12 years ago

brianmhunt commented 12 years ago

When I make an amplify.js request, and the response does not conform to the jsend spec, it would be nice if amplify.js threw an exception (or could be run in "strict" mode where it would throw an exception).

This would help a little bit with debugging, since at the moment it seems that when an amplify.js request does not conform to the jsend spec neither the success nor error handler are called - the response is silently ignored. Explicit failure is preferable.

Thanks!

scottgonzalez commented 12 years ago

I'd much rather invoke the error callback than throw an error.

brianmhunt commented 12 years ago

@scottgonzalez I completely agree.

I am not sure how client-side errors fit into the jsend spec. I presume an error can simply be generated on the client side.