Suppose $M$ is a metric space and $\{ A_i \}$ is a countable collection of closed subsets of $M$ whose union is $M$ and s.t. $f$ restricted to $A_i$ is continuous for each $i$. Give an example to show that $f$ need not be continuous on all of $M$.
My instinct has been to construct some relatively simple function on $\mathbb{Q}$, but I'm wondering now if the example might be more pathological.