You think things are fine at work, only to learn your boss had been unhappy with you for quite some time. You think things are good with your marriage, but suddenly your spouse tells you he’s leaving. You assume your kids are doing well, and then you realize that serious problems had been simmering below the surface. And then, one day, it all falls apart, and you are left to pick up the pieces.
Sometimes we realize we weren’t really innocent bystanders. Perhaps we had been too complacent, too careless, and taken too many things for granted. Perhaps we knew things weren’t quite right, but we didn’t want to make the changes we knew needed to be made. But whether we could have prevented the disaster or not, we have to deal with the fallout as it is.
I’ve endured several of these surprise trials, and they still leave me reeling. I struggle with anger and despair. A complacent person by nature, I often have to repent of my own laziness and deliberate blindness. I often see in hindsight how I could have been a better steward of my time, energy, and responsibilities.
But what better time to apply to the gospel, than the times we have sinned? What better time to remember afresh that Christ had to die because we were going to continually mess things up? What better time to rejoice that we serve a God who is bigger than our sin, who has promised to work all things together for our good and his glory? (Romans 8:28)
And even if it's not the result of sin, just the problems that come with living in a fallen world, he still works those things for our good.
It’s the redemption that I need to cling to most tightly. I like how Jimmy Davis puts it in Cruciform: Living the Cross-Shaped Life:
Suffering for the Christian is neither the result of God’s punishment nor a sign of his rejection. The word discipline is used to indicate training, growth, improvement, advancement. It is for our good, an essential part of the continual redirection of our hearts away from our own me-first path and back onto God’s you-first path. Those who have been born anew into Christ’s kingdom must take up their crosses and die daily to their me-first hearts, following the one who took up his cross and “learned obedience through what he suffered” (Hebrews 5:8, see also Luke 9:23-25, Hebrew 2:10, Philippians 2:8).Whether my suffering is a consequence of my sin or not, it is never random, it is never purposeless, and it is never beyond God’s redemption.
We must endure—and by grace we can and will endure—whatever means God may choose in order to do us good through discipline. Part of the wonder of our salvation is that for each of us there is a unique and foreordained plan (the farthest possible thing from a series of random or pointless circumstances) by which God is committed to seeing us live a cross-shaped life (Hebrews12:3-7a). 
I haven’t mastered this. Far from it. And though many have endured far worse trials than any of mine, I still struggle with resentment when they happen. Many times, like Peter, I only turn to God because I don’t have anywhere else to turn. (John 6:68–69) 
We can’t predict or stop our trials, but we can change how we respond to them. We can shake our fists at the heavens and walk the path resentfully, or we can trust that God has a purpose beyond what we can see. We can use the time to grow in holiness or to harden with bitterness. I haven’t learned much in my 42 years—and sometimes I forget and have to learn it all over again—but God’s way, the way of holiness, is always best. And not just because we don’t have anywhere else to turn, but because he loves us better.
 Jimmy Davis, Cruciform: Living the Cross-Shaped Life, p 101.
 Ibid, p 98.