We have logic for dealing with cloning errors repeated in several
places. This patch combines it into one function that can be called
more easily without having to trap exceptions.
Change-Id: Ib5f6c3f801481b28513ce8fab0f5624c02e60d97
Signed-off-by: Doug Hellmann <doug@doughellmann.com>