Exactly, the Bible itself references the fact that bad times are inevitable and God Himself promised that he'll always be with us through it. This is how I also see bad times too, I've had a lot of it in my life and sometimes there's no better way to cope with it than to establish a closeness with God, and tell it to him in prayer.
Human beings can fail, but God can never fail, and that's why it's always best to tell him in prayer.
I hope it gets better for you too.
RE: How do you react to bad times?