exception handling for json and http request