Added correct exception handling for ajax requests and test page
Added correct exception handling for ajax requests and test page