"Thou hast dealt well with thy servant, O LORD, according unto thy word." (Psalm 119:65)
The good that comes from the hand of the Lord is "according unto thy word," a common phrase in Psalm 119 that occurs in 11 of the 22 stanzas.
Interestingly, the psalmist twice emphasizes that it was important for him to be "afflicted" before he learned something of the gracious provision of the Lord (Psalm 119:67, 71). The Hebrew word anah is used widely in the Bible, the most famous passage prophesying about the sacrificial death of the Lord Jesus: "Surely he hath borne our griefs, and carried our sorrows: yet we did esteem him stricken, smitten of God, and afflicted" (Isaiah 53:4).
Although affliction does not necessarily come because of personal disobedience (even though that surely happens among us), often the Lord uses an occasion to drive home a concept of holiness or obedience (according to His Word) that will bring His favor or, more properly, bring us in line with His Word so that we may experience the "peaceable fruit of righteousness" (Hebrews 12:11).
Three times the psalmist asked his Lord to teach him or let him learn from the Word about the eternal principles of righteousness (119:66, 68, 71). Three times he insisted that he will keep and delight in the holy laws and principles of which he is aware (119:67, 69, 70).
The core theme of this simple message focuses on the passionate commitment of the psalmist to learn and obey the Word of God. No past history can negate God's faithfulness. No present difficult circumstances can thwart God's promises. Thus: "The law of thy mouth is better unto me than thousands of gold and silver" (Psalm 119:72). HMM III