modified error exception handling