The concept of 'mental illness' in the analytic tradition of philosophy is a source of philosophical contention among those who study the philosophy of psychology, and some issues run right back into metaphysical debates of issues stemming from mind-body duality. A prominent question is 'To what extent is mental illness a function of the body, and to what extent a function of the mind?'. There isn't a clear demarcation between them, and notably after the heyday of philosophical and psychological behaviorism, cognitive and humanist psychologists reasserted themselves and the view that might be described as a wholesale rejection of the classical behaviorist methodology that could be construed as complementing eliminative materialism in its metaphysical presuppositions. Famous psychologists who began pushing back on behaviorism and mental illness as strictly a physical condition were Rollo May, Abraham Maslow, others. Humanistic psychology has been tremendously impactful on the analysis of the term 'mental illness', and has roots in the Continental philosophy and the humanist tradition. Today, another school of psychology has come into being spurred on by Martin Seligman: positive psychology. From WP's article on humanistic psychology:
The modern humanistic approach has its roots in phenomenological and existentialist thought (see Kierkegaard, Nietzsche, Heidegger, Merleau-Ponty and Sartre). Eastern philosophy and psychology also play a central role in humanistic psychology, as well as Judeo-Christian philosophies of personalism, as each shares similar concerns about the nature of human existence and consciousness. For further information on influential figures in personalism, see: Emmanuel Mounier, Gabriel Marcel, Denis de Rougemont, Jacques Maritain, Martin Buber, Emmanuel Levinas, Max Scheler and Karol Wojtyla.
Positive psychology, which can be seen as a moderate position between extreme humanistic thinking and behaviorist thinking, recognizes the biological basis of some mental illnesses, which is essentially an irrefutable proposition given the advances in cognitive science. But it also takes the view that wisdom is a legitimate object of study that has an impact on one's mental well being. In this sense, it complements the majority of approaches in psychotherapeutics which relies not on pharmaceutical strategies, but talk therapy and alignment of the individual views and personality with a contemporary and scientific view of the world. For instance, the notion of cognitive distortions plays heavily in the treatment of depression in CBT. Many modern strategies to reduce one's "friction with the world" often are essentially metaphysical in nature, with the examination of one and one's subjective experience the core of the therapeutic experience.
There is still the old-fashioned belief that mental illness is a question of exclusively using the medical model in a psychological thinking. The medical model (which is the abuse of the biomedical model) is a criticism of behaviorist thinking that stems back to a movement in psychology and psychiatry called anti-psychiatry. And given successes in treating schizophrenia and other diseases with medication, availing oneself of psychiatry and the biomedical model is a good strategy in some cases. But drugs and surgery have limits, and the preponderance of anxiety and stress people have in life have nothing to do with extremes of abnormal psychology in the strict sense, that is, examining distress, disease, deviance, and danger so severe that incarceration is necessary. Rather, there's a spectrum from optimal to sub-optimal to dysfunctional, and most people suffer some form of "emotional sniffles".
There is inevitably a social component to physical and mental health, and studying philosophy and wisdom to reduce mental distress and illness is a central core tenet of positive psychology. In this way, modern psychological practice has come full circle to the ataraxia of the Stoics and the eudaimonia of Ancient Greece more broadly. In this sense, mental illness is always a failure of wisdom when it can't be determined to be biological in basis. And "a failure of wisdom" in English means nothing more specific than a lack of wisdom is associated with the failure that corresponds nicely to the sub-optimal outcomes of observable behavior which is necessarily vague since sub-optimal is inherently a normative term.