Index: vhLib/LogOpkuiser.cls.xml =================================================================== diff -u -r3794 -r3803 --- vhLib/LogOpkuiser.cls.xml (.../LogOpkuiser.cls.xml) (revision 3794) +++ vhLib/LogOpkuiser.cls.xml (.../LogOpkuiser.cls.xml) (revision 3803) @@ -108,12 +108,16 @@ Do ResultSet.Close() Do ..Logger.Info("VerwijderLogRecords", "'" _ LoggingIdsToDelete.Count() _ "' te wissen voor datum '" _ Datum _ "', Niveau '" _ Niveau _ "'.") - + + Set ExceptionList = ##class(TECH.ExceptionList).%New() + #dim MaxAantalExceptiesPerRonde As %Integer = 5 ; Na x errors wordt de while loop afgebroken + #dim ContinueLoopToDelete As %Boolean = $$$True + #dim AantalGewist As %Integer = 0 #dim EersteIdGewist As %String = "" #dim LaatsteIdGewist As %String = "" Set IdsToDeleteIterator = ##class(TECH.ListIterator).%New( LoggingIdsToDelete ) - While IdsToDeleteIterator.HasNext() { + While (IdsToDeleteIterator.HasNext()) && (ContinueLoopToDelete) { #dim IdToDelete As %String = IdsToDeleteIterator.Next() Try { #dim sc As %Status = ##class(vhLib.Logging).DeleteLogging(IdToDelete) @@ -125,12 +129,21 @@ } Catch { #dim Exception As TECH.Exceptions.Exception = ##class(TECH.ExceptionHandler).Catch() - Do ..Logger.ErrorMail("VerwijderLogRecords", "'" _ AantalGewist _ "' reeds gewist voor datum '" _ Datum _ "', Niveau '" _ Niveau _ "'. Error bij record '"_IdToDelete_"' : "_Exception.GeefErrorInformatie()) + Do Exception.VoegToeExtraInfo("Record to delete ID='"_IdToDelete_"'") + Do ExceptionList.Insert(Exception) + Set ContinueLoopToDelete = (ExceptionList.Count() < MaxAantalExceptiesPerRonde) } } - + Do:(LoggingIdsToDelete.Count() > 0) ..Logger.Info("VerwijderLogRecords", "'" _ AantalGewist _ "' gewist voor datum '" _ Datum _ "', Niveau '" _ Niveau _ "'; Eerste ID='"_EersteIdGewist_"' LaatsteID='"_LaatsteIdGewist_"'.") + If ExceptionList.Count() > 0 { + Set OmvattendeException = ##class(TECH.Exceptions.GeneralErrorException).%New("Error bij VerwijderLogRecords. Aantal fouten: "_ExceptionList.Count() _$$$If(ContinueLoopToDelete, "", " (While-loop afgebroken, want max aantal fouten bereikt).") ) + Do OmvattendeException.ZetInnerExcepties(ExceptionList) + Do OmvattendeException.VoegToeExtraInfo("'" _ AantalGewist _ "' items reeds gewist voor datum '" _ Datum _ "', Niveau '" _ Niveau _ "'.") + Do ..Logger.ErrorMail("VerwijderLogRecords", OmvattendeException.ToStream()) + } + Quit AantalGewist ]]>