And Hashem said to Moshe and to Aharon: Because you did not believe in Me to sanctify Me in the eyes of the children of Yisrael, therefore you shall not bring this congregation into the land that I have given them.
Torah Temimah: Yoma 86b
English: It was taught: two good leaders stood for Yisrael, Moshe and David. Moshe said, let my failing be written, as it is said “because you did not believe in Me.” David said, let it not be written, as it is said “fortunate is he whose transgression is forgiven, whose sin is covered.”
Contrast of two leaders’ attitudes to publicized failure.
Moshe preferred that his shortcoming be recorded openly; David preferred concealment of sin.