updates http request error handling
declares the json variable outside the try-catch block
adds that case where a direct 'err' must be handled