Now despair seems to grow from a good root, viz. fear of God, or from horror at the greatness of one's own sins. Therefore despair is not a sin.
 Thomas Aquinas, Summa Theologica (1274). copy citation

add
Author Thomas Aquinas
Source Summa Theologica
Topic greatness fear
Date 1274
Language English
Reference
Note Translated by Fathers of the English Dominican Province
Weblink http://www.gutenberg.org/cache/epub/18755/pg18755-images.html

Context

“But despair includes no conversion to a mutable good. Therefore it is not a sin.
Obj. 2: Further, that which grows from a good root, seems to be no sin, because "a good tree cannot bring forth evil fruit" (Matt. 7:18). Now despair seems to grow from a good root, viz. fear of God, or from horror at the greatness of one's own sins. Therefore despair is not a sin. Obj. 3: Further, if despair were a sin, it would be a sin also for the damned to despair. But this is not imputed to them as their fault but as part of their damnation. Therefore neither is it imputed to wayfarers as their fault, so that it is not a sin.
source