added exceptions handling to parser