I spoke with a lady today as she waited for her vehicle to get jumped. Her battery had died. She said “The Lord answered my prayer. I was debating on whether or not to get a battery.”
Perspective is huge. 
James taught on the subject. He said “count it all joy when ye fall into divers temptations”. Look for the good in situations. Seek Jesus, his truths and promises. Ask him to comfort you. 
Scripture taken from:

James 1:2