It really depends on situation.
you can use try/catch but you have to keep in mind that the state of crash should be able to be recovered. this can be very hard and cumbersome and that’s the reason in many cases games rather completely stop.
another way is to have pre checks, and if they aren’t met then the actual code wont go further .
(example: you have a hardware connected, then first you check if it is available and only if it is, then you go further and accessing the hardware )