Is it safe?

I get chronic migraines, sometimes it feels like my brain is literally about to explode out of my head. There is a possibility I'm pregnant and I have been drinking tons of water so last night I had one and I tried to sleep it off but I woke up at 4am and it was so bad I was crying and my head was throbbing soooo bad. I took two Excedrin migraine would that be safe if it was a emergency?