Which type of anesthesia is better when having an operation?

Depends on... The operation, the patient, the surgeon, and other factors. Many procedures can be done with general anesthesia or conscious sedation (twilight sleep) and this is usually the patient's choice. Sometimes particular factors unique to the patient will determine which method is chosen. All are safe and effective when properly done by well trained personnel.
Depends on surgery. There are many different techniques that can be used to make your experience as pleasant as possible. Talk to your anesthesiologist about the surgery and learn which techniques are best for you.
Care team decides. This decision about anesthesia is made by your care team. They consider your overall health, your procedure and come up with the best for plan for you.