handle an exception from insert