What you want to avoid is misery. I banished misery from my life sometime in my early twenties. I am unhappy somewhat often, but never miserable. Misery means not seeing a way out of the circumstances making you unhappy.
I believe emotional health revolves as much in how you see your emotions as which emotions you're experiencing. Reframing the emotions you feel can be a quite powerful experience for those not too jaded on the woo-woo aspect of it. "I didn't lose my girlfriend, we just weren't right for each other." If all you do is reframe, and never do any real learning, then sure, you'll end up miserable. But in general finding a way to reframe setbacks is a great way to find the energy to keep moving rather than wallow.
For some people, creativity is tied intimately to misery; I believe that people for whom their creative output relies on drug use are ultimately deriving it from misery. Minds need to be in a loose, free state to mix seemingly-unrelated concepts together. When one is truly miserable, they cannot see a way out of their predicament and so mind naturally finds a way towards that state. If they could see a way, then they'd focus on that way, and having a single point of focus is pretty much the opposite of creativity.
The most prolific creators make a workflow out of managing their minds. They'll tune out in order to become unfocused enough to get an idea, then they'll focus on putting that idea to paper, or electronic media or whatever. Good coders are well-attuned to such a workflow, but often don't think of themselves as creative, perhaps because their output isn't immediately pleasing to the senses. Artistic, maybe not. But creative? Absolutely.