Added try-catch to assert thrown exception