Add error handling to all json requests