Handle errors with json error messages