Consider an improper integral with a pole on the integration contour at say $z=1$,
$$ \tag{1} I = \int_{-\infty}^\infty \mathrm{d}z\ \frac{e^{-z^2}}{z-1+i\epsilon},~~~~~\epsilon>0. $$ Let $$f(z) = \frac{e^{-z^2}}{z-1+i\epsilon}$$ then $$ \sum_{residues~inside~\Gamma} = 0 = \oint_\Gamma f(z) = I+\left(\int_{\Gamma_\epsilon}+\int_{\Gamma_\infty} \right) f(z), $$ where the total contour is $\Gamma\equiv (-R,R)+\Gamma_\epsilon+\Gamma_\infty$ with $R\rightarrow \infty$.
Thus $$ I = - \left(\int_{\Gamma_\epsilon}+\int_{\Gamma_\infty} \right) f(z). $$ The contour $\Gamma_\epsilon$ is a semicircle centered about $z = 1$ of radius $\epsilon$. Its contribution is given by $$ \int_{\Gamma_\epsilon} \mathrm{d}z ~f(z) = i (\theta_2-\theta_1)~ \mathrm{Res}(f;z=1) = \frac{-i\pi}{e}. $$
Evaluating $(1)$ in Mathematica and taking the $\epsilon\rightarrow 0 $ limit gives $$ I = e^{(\epsilon +i)^2} \left(-\pi \text{erfi}(1-i \epsilon )+\log (-1+i \epsilon )+\log \left(\frac{i}{\epsilon +i}\right)-2 i \pi \right) \\ \longrightarrow -\frac{\pi (\text{erfi}(1)+i)}{e}~~~(\text{as}~ \epsilon \rightarrow 0). $$
Thus apparently, $$ \tag{2} \int_{\Gamma_\infty} \mathrm{d}z \, f(z) = \frac{2\pi i}{e}+\frac{\mathrm{erfi}(1)}{e}. $$
Can anyone derive this contribution from the semicircle at infinity? I.e. is $(2)$ correct and how about generalizations of $(1)$ to integrals of the form
$$\tag{3} I = \int_{-\infty}^\infty \mathrm{d}z\ \frac{z^n e^{-z^2}}{(z-a+i\epsilon)(z-b-i\epsilon)},~~~~~\epsilon>0,a,b\in\mathbb{R},n\in \mathbb{N}. $$
Note, erfi is defined as $\mathrm{erfi}(z) \equiv \mathrm{erf}(iz)/i$ with the familiar error function.
The contribution from the (superfluous) deformation of the segment on $[0,2]$ to a semicircle is cancelled by other parts of the integral along the real axis. This deformation crosses no poles, so the path integral along $\Gamma_\epsilon + [0,2]$ is zero.
So what's going on? In your expression $$ I+\left(\int_{\Gamma_\epsilon}+\int_{\Gamma_\infty} \right) f(z) \text{,} $$ you have two paths from $0$ to $2$. One runs along the real axis and is contributed by $I$. The other runs along $\Gamma_\epsilon$. It should come as no surprise that this contribution is overcounted in the result you have.