Screaming as if in pain

I just got my LO to settle down, she was screaming as if in pain for over 30 minutes. Nothing I did would soothe her she was screaming so hard she made herself throw up. She was content in her swing I started to babble with her and she just started screaming. Finally laid her on my bed which calmed her a little so I put her in her swaddle and she fell asleep. What do you do when this happens? It freaked me out because it seemed like she was in so much pain.