I can simplify the function to just a single SetLastError (or even none) if it means I can get this MR approved (and eventually merged)
Well, that is what was requested. More generally, though, it's not about getting one's patches merged, it's about committing correct code, and improving the project.