Approximate posterior inference for Bayesian nonparametrics with total variation error bounds