I was in a supervisory role in local government when my depression hit. My biggest mistake was not recognising I had a problem and seeking help eary enough.
If I had, perhaps I would still be there, I don't know. Unfortunately I ended up off work for 18 months.
I have recently started work in a much less responsible position in a completely different industry. While I am feeling a lot better and am grateful for the opportunity to get back into work of some kind, my natural tendency to fill the gaps, and make improvements is very much an issue for me to come to grips with.
My suggestion - if you are not already doing so, perhaps see a pdoc for some support and strategies in dealing with your issues and how to manage your doubts/fears at work, before they overtake you. I also hear life coaches work with individuals in this area too.
Good luck - try not to doubt yourself.
They say life is a bowl of cherries........... we just have to learn how to spit out the pips!