@@ -107,15 +107,13 @@ static Function ProcessCurrentExperiment(STRUCT MultiExperimentProcessPrefs &pre
107107 DoWindow / K HistoryCarbonCopy
108108 NewNotebook / V=0/ F=0/ N= HistoryCarbonCopy
109109
110+ AssertOnAndClearRTError ()
110111 try
111112 PerformMiesTasks ( outputFilePath) ; AbortOnRTE
112113 catch
113- ClearRTError ()
114- print "Caught an RTE"
114+ printf "Caught an RTE or abort: V_AbortCode=%d\r " , V_AbortCode
115115 JSON_AddBoolean ( jsonID, "/log/" + num2str ( index) + "/error" , 1 )
116116 JSON_SetVariable ( jsonID, "/errors" , JSON_GetVariable ( jsonID, "/errors" ) + 1 )
117- HDF5CloseFile / A/ Z 0
118- DeleteFile / Z outputFilePath
119117 endtry
120118
121119 Notebook HistoryCarbonCopy, getData=1
134132static Function PerformMiesTasks ( string outputFilePath)
135133
136134 string folder, message, devSuffix, outputFilePathWithDevSuffix
137- variable error
135+ variable error, doAbort
138136
139137 printf "Free Memory: %g GB\r " , GetFreeMemory ()
140138
@@ -144,21 +142,27 @@ static Function PerformMiesTasks(string outputFilePath)
144142 CreateFolderOnDisk ( folder)
145143 endif
146144
147- ClearRTError ()
148-
149145 WAVE /T devicesWithContent = ListToTextWave ( GetAllDevicesWithContent ( contentType = CONTENT_TYPE_ALL) , ";" )
150146
151147 for ( device : devicesWithContent)
152148 devSuffix = SelectString ( DimSize ( devicesWithContent, ROWS) > 1, "" , NWB_GetFileNameSuffixDevice ( device))
153149 outputFilePathWithDevSuffix = RemoveEnding ( outputFilePath, NWB_FILE_SUFFIX) + devSuffix + NWB_FILE_SUFFIX
154150
155- NWB_ExportAllData ( NWB_VERSION_LATEST, overrideFullFilePath = outputFilePathWithDevSuffix, device = device)
156- HDF5CloseFile / A/ Z 0
151+ AssertOnAndClearRTError ()
152+ try
153+ NWB_ExportAllData ( NWB_VERSION_LATEST, overrideFullFilePath = outputFilePathWithDevSuffix, device = device) ; AbortOnRTE
154+ catch
155+ HDF5CloseFile / A/ Z 0
156+ DeleteFile / Z outputFilePath
157+ doAbort = 1
158+ endtry
159+
160+ message = GetRTErrMessage ()
161+ error = ClearRTError ()
162+ ASSERT ( error == 0, "Encountered lingering RTE of " + num2str ( error) + "(message: " + message + ") after executing NWB_ExportAllData." )
157163 endfor
158164
159- message = GetRTErrMessage ()
160- error = GetRTError ( 1 )
161- ASSERT ( error == 0, "Encountered lingering RTE of " + num2str ( error) + "(message: " + message + ") after executing NWB_ExportAllData." )
165+ ASSERT ( doAbort == 0, "Encountered abort" )
162166End
163167
164168static Function IsAppropriateExperiment ()
0 commit comments