added try/catch to ajax request handler