Throwing an Error message when the app crashes

...Hi,
I want to integrate a feature in my rshiny app wherein every time the code crashes a generalised error saying "sorry something wrong with the code"" gets displayed in my app. Can you please help me with this