Route for crashes, missing urls etc?

Someone mentioned to me that you can set a route in environment.rb for
when the app crashes, or someone puts in a bad url, or anything ‘bad’
basically - does anyone know how to set this up please?