replaced naked throws by approximation_error calls in all algorithms.