What to catch {throw; } do?
I just found this stone in a spaghetti heap that I have to maintain:
try { Foo(); }
catch { throw; }
Can i replace it
Foo();
?
+3
Ansis MΔliΕΕ‘
source
to share
2 answers
Yes . It's exactly the same. Perhaps someone used it to set a breakpoint in the catch block.
+9
nvoigt
source
to share
Yes, try / catch can be removed here. Often this code is created in iterations: initially it was the exceptions handled there, but later it was lazily removed.
0
ISanych
source
to share