39 The Lord was sorrowful then unto death because in presence of the death, the earthquake, the darkened day, the rent veil, the opened graves, and the resurrection of the dead, the faith of the disciples would need to be established which had been so shaken by the terror of the night arrest, the scourging, the striking, the spitting upon, the crown of thorns, the bearing of the cross, and all the insults of the Passion, but most of all by the condemnation to the accursed cross. Knowing that all this would be at an end after His Passion, He was sad unto death. He knew, too, that the cup could not pass away unless He drank it, for He said, My Father, this cup cannot pass from Me unless I drink it: Your will be done: that is, with the completion of His Passion, the fear of the cup would pass away which could not pass away unless He drank it: the end of that fear would follow only when His Passion was completed and terror destroyed, because after His death, the stumbling-block of the disciples' weakness would be removed by the glory of His power.
Source: On the Trinity (New Advent)