The vector field is obviously conservative on every closed domain that doesn't encompass the point $(0,0)$, so there must be a potential function.
I've got $\arctan(\frac{x}{y})$ for $x$ unequal to zero and $\arctan(\frac{y}{x})$ for $y$ unequal to zero.
However, when I try to find the line integral of the given field from point $(1,0)$ to point $(0,1)$ I get $\frac{\pi}{2}$, but when I try to find the result by using the potential function I get $0$.
What am I doing wrong?
Thanks in advance.
The field is $$ u = \frac{-y}{x^2+y^2}\mathbf{e_x}+\frac{x}{x^2+y^2}\mathbf{e_y}=\frac1{r} \mathbf{e_\theta}$$
In cylindrical coordinates
$$\nabla \phi = \frac{\partial \phi}{\partial r}\mathbf{e_r}+\frac1{r} \frac{\partial \phi}{\partial \theta}\mathbf{e_\theta}=\frac1{r} \mathbf{e_\theta}.$$
So $\phi = \theta$ has that field as the gradient.
As @enzotib observed
$\phi = \theta= \arccos\left(\frac{x}{\sqrt{x^2+y^2}}\right)$