adding error handling to form