Catching and reacting to a warning [closed]

I have a program which can lead in certain cases to a division by zero. I would like to know if there is a way in Mathematica to make a conditional statement like the following one:

If[Warning == Power:: infy: Infinite expression 1/0 encountered, something, somethingelse]


As it is a complex piece of code borrowed from an old Paper from the Mathematica Journal, I would like not to search exactly what line is the cause of the warning and program what to do in this case.

Clear[fun]

This function will generate a division by zero roughly half the time, randomly. You can evaluate it a few times, and you will see that when the division by zero happens, Quiet prevents the message from being displayed, but you still get the "FAILED" output to indicate the problem, which you can replace with whatever makes sense for you in your case.