I just found this gem in the pile of spaghetti I have to maintain:
try { Foo(); }
catch { throw; }
Is it safe to replace it with
Foo();
?
I just found this gem in the pile of spaghetti I have to maintain:
try { Foo(); }
catch { throw; }
Is it safe to replace it with
Foo();
?
Yes. It's exactly the same. Maybe someone used it to put a breakpoint in the catch block.
Yes, it is safe to delete try/catch here. Often such code created in iterations: initially it was exceptions processing there, but later it was lazily removed.