Error handling in the JSON request