implementing try-catch in display functions