Added exception handling

Signed-off-by: Deepak Jha <deepak.jha@turn.com>