} catch (Throwable th) {
String msg =
"Error updating " + whichIndex + " index for " +
pid;
logger.error(msg, th);
throw new GeneralException(msg, th);
}
} catch (Throwable th) {
if (obj.isNew()) {
// Clean up after a failed attempt to add
try {
removeObject(obj, true);
} catch (Exception e) {
logger.warn(
"Error while cleaning up after failed add for " +
pid, e);
}
}
if (th instanceof ServerException) {
throw (ServerException) th;
} else {
throw new GeneralException(
"Unable to add or modify object " + pid +
" (commit canceled)", th);
}
}
}