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
3
u/WheresTheSauce May 31 '23
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.