added bad request exception and json error check for request