Not everything happens for a reason. Not all bad events (illness, family issues, financial dramas) occur to test us, or to show us something, or because we have been less than perfect.
Sometimes shit just happens. Shit happens to bad people and good people equally. It doesn’t necessarily mean that you attracted it, sometimes you were just in the wrong place at the wrong time. That’s the universe and its chaos and randomness for you. Some things are just inexplicable.
Don’t overanalyse events. Don’t try to work out the reason or the lesson in everything that occurs in your life. It happened. Acknowledge that and move on. Otherwise you will never be able to move forward.