Seng:
see http://root.cern.ch/root/html/examples/gerrors2.C.html.
I'd also suggest you to look at the existing tutorials and HOWTO's at
http://root.cern.ch - you may find there answers to your other questions
so reading these sources could save you a lot of time.
-pasha