Exception handling for Generate Password