Handle exceptions for chart generation.