updated exception message and added test for exception