Migliorato log errore in exchange fornitori

This commit is contained in:
2024-12-16 17:00:27 +01:00
parent c6f85fe920
commit 1b64a2f745
2 changed files with 58 additions and 52 deletions

View File

@@ -9,6 +9,7 @@ import it.integry.ems.system.exchange.service.structure.ExchangeImportSchemaMana
import it.integry.ems_model.base.EquatableEntityInterface;
import it.integry.ems_model.entity.AtbForn;
import it.integry.ems_model.entity.GtbAnag;
import it.integry.ems_model.exception.EntityException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
@@ -74,10 +75,15 @@ public class ExchangeFornitoriImportService {
internalMultiDb.commitAll();
exchangeMultiDb.commitAll();
} catch (Exception ex) {
if (firstExceptionToThrow[0] == null) firstExceptionToThrow[0] = ex;
logger.error("Errore durante l'importazione del fornitore", ex);
internalMultiDb.rollbackAll();
exchangeMultiDb.commitAll();
GtbAnag gtbAnagError = (GtbAnag) dataToSave;
Exception newException = new EntityException("Errore durante l'importazione del fornitore [" +
"cod_anag: " + gtbAnagError.getCodAnag() + "]", ex);
if (firstExceptionToThrow[0] == null) firstExceptionToThrow[0] = newException;
logger.error(newException);
}
}