I have a script that reads data from a file, then sets the dgData of my datagrid and then continues with other things. Now I noticed that when the data from my file is somehow corrupt my script quietly aborts when setting the dgData. How can I detect this error before the script abourts? I would like to display a warning like " your data is corrupt" and then continue with the rest of my script. How can I do this?
Here is my script:
Code: Select all
on readtreatment
   put tPATH & "/patientdata/TREATMENTS/" & patientID & ".txt" into tempfilepath
   if there is a file tempfilepath then
      put URL ("binfile:" & tempfilepath) into theEncodedArray
      decrypt theEncodedArray using "aes-256-cbc" with password globalpass and salt saltvalue
      if it is empty then
         -- beep
         exit readtreatment
      end if
      put it into theEncodedArray
      put arrayDecode(theEncodedArray) into tempdata
      set the dgData of group "treatmentlist" of card "treatment" to tempdata
   else
      set the dgData of group "treatmentlist" of card "treatment" to empty
   end if
end readtreatmentOliver
