Add Exception Handling

Exception handling added for FormatException errors.