As with all medications, there is the possibility of an allergic reaction to one or more agents used during anesthesia. Anesthesia is divided into two broad categories, General (where you are fully asleep) and Conduction (where pain impulses are blocked from reaching the brain). Each of these categories has variations on its theme: General, ranges from slight sedation to the fully asleep version, and Conduction, blocking small nerves near the site of surgery to larger nerves near the center of the body, the spinal cord.
A medical history is the primary method to determine allergies to medications and anesthesia. If you have family members who have had a reaction to an anesthetic or allergies to certain medications, many of these are used in modern anesthesia. Some allergies follow family heredity and some are patient specific. Even allergies to certain foods can give us a hint as to a potential drug allergy in anesthesia. Most anesthesia agents and medications are well proven with millions of successful anesthetics administered every year.
If during a surgery, a patient shows signs of an allergic reaction, the medication or agent is stopped and another used in its stead. Anesthesia providers are very diligent about observing patients under anesthesia. Possible drug reactions or allergies are always watched for during an anesthetic.
If no allergy was discovered in the history, the only alternative to find out before the surgery would be, allergy testing for the major classes of medications used in anesthesia.
Thanks again for your question.