Add test to check that exception is catched properly