Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Error being raised With COM+
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00528556
Message ID:
00529685
Vues:
7
NO!!! NEVER Use ComReturnError(), If you use it, you cannot predict where your code is currently doing and your GC will NOT be executed, causing very impredictable results and C5. Use a smart error handling instead, something like this:
DEFINE CLASS MyClass As Session
  
  ErrorText = ""
  ErrorOccured = .F. 
  PROTECTED ErrorText, ErrorOccured

  Function SomeFunction( cPar )
   LOCAL lcResult

   *-- Create Your MTS Object context Here

   *-- Do some processing to build lcResult
   lcResult= GetSomeXmlString()
   IF This.ErrorOccured
      lcResult = This.ErrorText 
   ENDIF
   
   *-- Call SetComplete() Or SetAbort() Here

   RETURN lcResult 

  ENDFUNC

   PROTECTED FUNCTION Error( p1,p2,p3 )
       This.ErrorOccured = .T. 
       This.ErrorText = GetXmlErrorString(p1,p2,p3)
   ENDFUNC

ENDDEFINE
>However, for a stateless COM application like a web app (vfp mtdll), ALWAYS use ComReturnError. This is a good rule-of-thumb for web apps.
>>In addition to my previous reply, i just look at your code and remembered of another rule you should follow:
>>
>>- NEVER use ComReturnError() Using it will cause your component to stop executing and return the control to the client, again bypassing any Garbage collection method you may have. Since you never know where an error occurs in the code, it would also be impossible to predict the effect of stopping code execution.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform