Login
`
Templates, Tools and Utilities
|
||
Add a comment to an Icetips ArticlePlease add your comments to this article.
Please note that you must provide both a name and a valid email address in order
for us to publish your comment. Comments are moderated and are not visible until they have been approved. Spam is never approved!
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 December 3, 2024, 11:36 am This article has been viewed 35398 times. Google search has resulted in 18 hits on this article since January 25, 2004.
|
|