General relative error criterion and M-estimation