We study the error in quadrature rules on a compact manifold. Our estimates are in the same spirit of the Koksma-Hlawka inequality and they depend on a sort of discrepancy of the sampling points and a generalized variation of the function. In particular, we give sharp quantitative estimates for quadrature rules of functions in Sobolev classes.