Handle errors in posted json better