I'm studying the Cauchy Integral Theorem / Formula, but realised I have a misunderstanding.
Consider an integral over the function $f: \mathbb{R} \to \mathbb{C}$ $$ I = \int^\infty_{-\infty} f(x) \, dx = \int^\infty_{-\infty} \frac{e^{ix}}{x^2 + 1} \, dx \quad. $$
This can be considered in the complex plane, where $f(z)$ is holomorphic except at its two poles at $z = \pm i$. Choosing to consider the positive case, we therefore factorise as
$$ I = \int_C \frac{\frac{e^{iz}}{z+i}}{z-i} \, dz = 2\pi i \frac{e^{-1}}{2i} =\pi e^{-1} \quad , $$
where the contour $C = C_R + C_+$ is taken anticlockwise, $C_R$ is the real axis between $\pm R$ and $C_+$ is the positive semicircle in the complex plane with $\left|z\right| = R$. It's clear from inspection that $C_+$ does not contribute to the path integral if we let $R \to \infty$, so we can equate the integral in the complex plane to the real integral $I$.
Now my question: I could equally well have chosen the negative half of the complex plane ($C'=C_R + C_-$) to evaluate my integral, negating the answer since the anticlockwise integral would otherwise calculate $\int_{\infty}^{-\infty}$. This would give
$$ I = - \int_{C'} \frac{\frac{e^{iz}}{z-i}}{z+i} \, dz = - 2\pi i \frac{e^{+1}}{-2i} =\pi e^{+1} \quad . $$
But clearly, that's different to my previous calculation. I thought these two methods should give the same answer, so what went wrong?