Error catching for delete