Handle username errors, moved error handling to its own method