Carleson theorem (later extended by Hunt) states that given an $L^2$ function $f:{\mathbb R}/{\mathbb Z}\to{\mathbb C}$, the set of points $x$ where the Fourier series $$\lim_{n\to\infty}\sum_{k=-n}^n\hat f(k)e^{2\pi ik x}$$ does not converge to $f(x)$ has measure 0.

Kahane and Katznelson proved that given any measure zero set $E$ there is a continuous function $f:{\mathbb R}/{\mathbb Z}\to{\mathbb C}$ whose Fourier series diverges at all points of $E$.

These two results leave a little gap.

What is known about those sets $E$ for which there is an $L^2$ (or even continuous?) function $f$ whose Fourier series diverges at all points of $E$ and pointwise converges to $f$ at all points not in $E$?

There is some ambiguity with the question as currently stated, as it depends on the representative of the $L^2$-class of $f$ that one chooses. I would hope an answer would help clarify the effect of specific representatives. Let me point out that, once we pick representatives, *not* every measure zero set can be such an $E$. If $f$ is continuous, this is easy to see; in fact, $E$ must be Borel (of low complexity; and this of course seems related to this question). As pointed out below in a comment by Juris Steprans, just on cardinality grounds we know not every measure zero set can appear, even for $L^2$ functions. Hunt's extension of Carleson's result says that we may assume $f\in L^p$ for any $p\in(1,\infty)$; I do not even know whether the sets $E$ will vary with $p$.