Exception handeling in parser

Signed-off-by: Ajeet Jha <ajeetjha1@gmail.com>