added try and catch block in test of exceptions