These are quite poor examples TBH. The refactoring of the first one has added error logging, which confuses matters as the new code actually does something different to the original.
In both refactoring cases (particularly in the 2nd, but also in the 1st if the logging were not added) it probably would have been easier (and possibly more efficient) to simply combine the if statements
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
These are quite poor examples TBH. The refactoring of the first one has added error logging, which confuses matters as the new code actually does something different to the original.
In both refactoring cases (particularly in the 2nd, but also in the 1st if the logging were not added) it probably would have been easier (and possibly more efficient) to simply combine the
if
statements