Refactor error for handling user profile