Handle exceptions with grace