Updated errors thrown and unit test.