Pregnant and depressed

I feel like a complete idiot.

I was with someone for 4 years.. we had 2 miscarriages 2 years ago and haven't been able to get pregnant since.. and we were going thou our stuff so I decided to break up w him. At first he agreed it was for the best. But then he took it back and begged me back.. but I started seeing someone already so I told my bf no.. and I found out a week ago I'm pregnant with the new guy I'm seeing..it was a complete surprise.. and when I found out. I felt like I betrayed my ex. But time passed and I felt little bit better but today. I can't stop crying. I want to tell my ex. I want to apologize. I wanted this with him. I know I did this to myself.. but I'm so upset I can't eat or sleep. Just constant tears.