Added utility exception handling function