Created panic function to handle certain exceptions