The seriousness of the sin committed will mainly derive from the gravity of the fault or limitation disclosed. But it will also depend on the dignity of the person detracted and the harm done to him and others by revealing something that is hidden and whose disclosure lowers (if it does not ruin) his standing in the public eye. …
When the revelation of another person’s fault is necessary or very useful, as in defense of self or of others, no injustice is done in revealing it. This would be the case when the failing or defect is made known to parents, or superiors, or for the purpose of seeking counsel or help, or to prevent harm to others, though again, there must be adequate proportion between the lessening of a person’s reputation (which is not intended) and the good to be achieved by the disclosure (which is intended). This would cover such contingencies such as anticipating unjust harm to oneself in the law courts, or even seeking consolation of a trusted friend by revealing the injustice done.
The Catholic Catechism: A Contemporary Catechism of the Teachings of the Catholic Church, p. 409