We give error estimates for the weighted approximation of functions with singularities at the endpoints on the semiaxis by some modifications of Sz\'asz--Mirakyan operators. To do so, we define a new weighted modulus of smoothness and prove its equivalence to the weighted K-functional. Also, the class of functions for which the modified Sz\'asz--Mirakyan operator can be defined will be extended to a much wider set than for the original operator.