Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Error 2027 DLL Caused an Exception
Message
 
 
To
10/02/2014 16:11:28
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 8
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01593920
Message ID:
01593937
Views:
57
>>>Ok Based on the above I Tried to make Changes in my Code. But seems to be not Okay ? I also didn't got how I will log the Error. Can you please extend your help based on my Code as mentioned below.
>>>
>>>
>>>nRECCOUNTCONVERT=ALLTRIM(STR(RECCOUNT()))
>>>cRECCOUNTCONVERT=' of '+ALLTRIM(STR(RECCOUNT()))
>>>Local loMyObject
>>>loMyObject = CreateObject("MyObject")
>>>loMyObject.Mainprocess()
>>>Return
>>>
>>>DEFINE CLASS MyObject AS Custom
>>>PROCEDURE Mainprocess
>>Local Parallel as Parallel
>>>local llReTry
>>llReTry = .f.
>>
>>>Parallel = NewObject("Parallel", "ParallelFox.vcx")
>>>Parallel.SetWorkerCount(Parallel.CPUCount)
>>>Parallel.StartWorkers()
>>>
>>>SCAN
>>>oFilename=ALLTRIM(Fullpath)
>>>iFilename=ALLTRIM(Newpath)
>>>RCNON=Recno()
>>>Try
>>>Parallel.CallMethod("Pdf2Ps", This.Class, This.ClassLibrary,,,oFilename,iFilename,RCNON)
>>>catch to loError
>>>   if loError.ErrorNo = 2027
>>>       llReTry = .t.
>>>   else
>>> *     log the error
>>>   endif
>>>ENDTRY
>>>if m.llReTry
>>>   try
>>>Parallel.CallMethod("Pdf2Ps", This.Class, This.ClassLibrary,,,oFilename,iFilename,RCNON)
>>>   catch to loError
>>> *     log the error
>>
>>>ENDTRY
>>>ENDSCAN
>>>ENDPROC
>>>
>>>PROCEDURE PDF2PS
>>>PARAMETERS oFilename,iFilename,RCNON
>>>Declare INTEGER VeryPDF_PDF2Vector in pdf2vec.dll String strCommandLine
>>>Strcmd= 'pdf2vec -$ XXXXXXXXXXXXXXXX '+CHR(34)+iFilename+CHR(34)+" "+CHR(34)+oFilename+CHR(34)
>>>nRet = VeryPDF_PDF2Vector(strcmd)
>>>Sys(2335, 1)	&& disable unattended mode, allow UI
>>>WAIT WINDOW 'Converting to PS..'+ALLTRIM(STR(RCNON)) NOWAIT
>>>RETURN
>>>ENDPROC
>>>ENDDEFINE
>>>
>>>
>>
>>I made some changes in your code.
>>
>>Logging the error is normally done with writing to a log file with strtofile. We have a special WriteToLog method which uses strtofile to write to the log file. You will need to implement your own logging of the error.
>
>Thanks, It worked fine than before, Previously it was giving error at Many instances but now giving errors at 4-5 Instances when I take the sample of 1000 files, Seems that the Second TRY is making the conversion success. Is it not possible to Keep TRYING unless it succeeds using DO WHILE.

It is possible to keep trying. I would change the code this way then
llReTry = .f.
lnAttempts = 0
try

   code that may fail
catch to loError
   if loError.ErrorNo = 2027
       llReTry = .t.
  endif
endtry
   

do while m.llReTry = .t. and m.lnAttempts <= 10
     lnAttempts = m.lnAttempts + 1
   
    try

   code that may fail
   llReTry = .f.
catch to loError
   if loError.ErrorNo = 2027
       llReTry = .t.
  endif
endtry

enddo
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform