; JobErrorFunction Example ; ------------------------ Graphics 640,480,0,2 SetBuffer BackBuffer() ; The checksum helper is where the deliberate failure happens Worker Function VerifyChecksum(stored) If stored<>1234 Then RuntimeError "Save file checksum mismatch" Return True End Function ; This worker fails on purpose while loading a corrupted save file Worker Function LoadCorruptSave(inputBank) SetJobProgress 1L,2L,"Verifying checksum" ; Busy work standing in for real parsing For parse=1 To 4000000 noise#=Sin(parse) Next ; The stored checksum is wrong, so the helper raises the error VerifyChecksum(9999) Return CreateBank() End Function job=StartJob(LoadCorruptSave) While Not KeyDown(1) Cls Text 0,0,"Esc: exit" Text 70,160,"Loading save file on a worker thread..." If JobState(job)=JOB_FAILED ; JobErrorFunction names the innermost Worker Function that failed Text 70,210,"JobErrorFunction(job) = "+Chr(34)+JobErrorFunction(job)+Chr(34) Text 70,240,"JobError(job) = "+Chr(34)+JobError(job)+Chr(34) Text 70,270,"The failure happened inside the VerifyChecksum helper" Else Text 70,210,"Still loading..." EndIf Flip Wend FreeJob job End