Solution (source code)

= Solution

In <spherical coordinates>, with polar angle $0\le\theta\le\pi$ and azimuth $0\le\varphi<2\pi$, the <volume element> is
$$
\boxed{dV=r^2\sin\theta\,dr\,d\theta\,d\varphi.}
$$
The <mass density> is radial, so integrating over both angles gives
$$
\begin{aligned}
M&=4\pi A\int_0^R(1-e^{-r/r_0})\,dr\\
&=4\pi A\left[R-r_0(1-e^{-R/r_0})\right].
\end{aligned}
$$
Writing $q=r_0/R>0$, this becomes
$$
\boxed{M=4\pi ARf(q),\qquad f(q)=1-q+qe^{-1/q}.}
$$
Although the <mass density> diverges like $A/(r_0r)$ near the origin, multiplication by the spherical <volume element> gives an integrable expression. Thus the central singularity does not produce infinite <mass>.