Corrected exception handling for delete and edit