I don't know if this helps or hurts generally, about mental illness, I don't know your specific circumstance or people you have interacted with who have mental illness. But feeling slapped with a label for the rest of your life feels like a huge burden to carry. Just because, you made some big 'mistakes', in front of someone who had the authority to give you that label.
Something I'm personally very stubborn about, and very outspoken about, is mental illness discrimination. You can read through these papers and see if they make sense to you, if you want to. I'm not sure how many of the papers I've read throughout my life about psychology, neuroscience, etc, but I've read a lot. I'm not a psychologist, therapist, or anyone who has been correctly (via an accredited institution) educated in mental health care, and I only study myself, and to a lesser degree, my family, as they study me. Mental illness should be a label you can have removed - because every variation of behavior mental illness describes as negative can also have a positive side, and trying to remove all the things mental illness labels as negative can really be handicapping, eventually. You need 'black and white' thinking for software development. Application of it to social systems, can be useful, but only in chaotic social systems where people identify you as 'the enemy', which is just as much up to them as it is to you.
Trying to identify one big thing as 'the error' in life just, this a burdensome mindset to have. No matter what it gets attached to. Oneself can convince oneself they believe 'that was it, that was the error' at any moment in time. Those things aren't future proof, and it's erroneous to assume they are.
https://www.tandfonline.com/doi/abs/10.1080/1747091080231971...
http://www.jneurosci.org/content/25/49/11489?utm_source=Tren...