Framework for Error Management through Sampling Functions