` Overriding error class to log errors to file (Joseph Lucas) - Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

Icetips Article

Back to article list   Search Articles     Add Comment     Printer friendly     Direct link  

ABC: Overriding error class to log errors to file
1998-12-14 -- Joseph Lucas
 
Newsgroups: topspeed.products.c4 I have a conversion program which reads our clarion 2110 .dat files and copies them to our SA database. Here's what I do: 1) In Global properties, Classes tab, General button - I changed the ErrorManager to AppErrors. 2) In Global properties, Embeds, After Global Includes - I added the following: AppErrors CLASS(ErrorClass) WriteError PROCEDURE END 3) In Global properties, Embeds, Program Procedures - I added the following: AppErrors.WriteError PROCEDURE CODE Global:Error = SELF.SubsString() SELF.SetID(Msg:AddFailed) ! This Error message contains the %ErrorText macro. ASC:Line=CLIP(ASC:Line) &' '& SELF.SubsString() ! This method translates %ErrorText to the ADD(AsciiFile) ! pertinent ERRORCODE()&ERROR() values. 4) In Global properties, Embeds, After File Declarations - I added the following: AsciiFile FILE,DRIVER('ASCII'),NAME(LogFileName),PRE(ASC),CREATE Record RECORD,PRE() Line STRING(2048) END END 5) In my source procedure when I'm ready to write a record to the SA database I use: IF Access:Dx.TryInsert() ASC:Line = '** DX ('&CLIP(DX:DxCode)&' '&DX:DxType&') File Error' GlobalErrors.WriteError END 6) In Setup, Application Options, Generation tab - Turn off (uncheck) "Enable #ASSERT checking". That should do it, let me know if I forgot anything. HTH, ---------------------------------------------------------------- Joseph Lucas


Today is November 21, 2024, 3:59 am
This article has been viewed 35388 times.
Google search has resulted in 18 hits on this article since January 25, 2004.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: