Last Updated: February 25, 2016
·
1.963K
· craigmarvelley

Handling exceptions and authentication with AJAX and Symfony2

I needed to elegantly deal with exceptions that arose when making AJAX requests to a Symfony2 application, and after putting together a few approaches that I found on the 'net I came up with an approach that I've written up here:

http://marvelley.com/2012/12/20/symfony2-json-responses-for-xhr-errors-and-authentication-failures/

I've also put together a demo application which can be used to see my solution in action:

https://github.com/craigmarvelley/symfony2-xhr-error-handling