added try catch when the service is called and throws an exception for invalid parameters