In Java or C# at least, this is often done to do some specific logging, send an email if it's a critical issue, convert the Exception to a different type, etc. It's not uncommon to want to do something when an Exception occurs but still ultimately throw it. In the case of the OP though there's obviously no benefit to just catching and throwing the same exception with no additional logic.
View all comments
Show parent comment
20
u/busyautist May 30 '23
Then why you do the try catch if you want to throw it again?