updates to registration form, Utility method for handling errors