[Misc] Added a unit test to test the exception path