536 add error handling for ajax requests

just wondering... Is it possible for us to write js with normal spacing and minify them in build script?
It's quite impossible to do the reviews with minified js.
#536