Well even though im not an expert in this matter(maybe you should go to a psychiatrist to ask some proper advice),it sounds like an panic attack.
Panic attacks are related with stressfull situations and i think that being under drug effect makes it much more 'spectacular' and frightnening.
I guess you got really scared so try to recognize it to yourself maybe talk to some close friend about it makes you feel more comfortable.
Maybe avoid smoking weed for some days or try doing that with someone you can trust.
I think panic attacks are like alarms from our head-just try to take it easy with yourself and start thinking the possibility of reducing or cutting off weed.
Things that relax you and makes you feel better with yourself would be much of a help right now.
It was a really bad experience but you managed to get through it,so you are capable of doing that and if it comes along again just remember it and this will help u.
If you have another panic attack when you are sober,dont neglect it and seek for some professional help.
If it sounds impossible at the moment,try to see it as an good in bad experience that came from your subconcious and want to tell something about u.
believe that you are ok and you will be and dont underestimate weed,its a light drug but remains a drug that is playing with your head.