Specifications

ErrorHandling
3-9
3
ErrorMacros
TheerrormacrosassociatedwiththeiplError()functionaredescribed
below.
#defineIPL_ERROR(
status
,
func
,
context
)\
iplError((
status
),(
func
),(
context
));
#defineIPL_ERRCHK(
func
,
context
)\
((iplGetErrStatus()>=0)?IPL_StsOk\
:IPL_ERROR(IPL_StsBackTrace,(
func
),(
context
)) )
#defineIPL_ASSERT(
expr
,
func
,
context
)\
((expr)?IPL_StsOk\
:IPL_ERROR(IPL_StsInternal,(
func
),(
context
)) )
#defineIPL_RSTERR() (iplSetErrStatus(IPL_StsOk))
context
Providesadditionalinformationaboutthecontextin
whichtheerrorhasoccurred.Ifthevalueof
context
isNULLorempty,thisstringdoesnot
appearintheerrormessage.
expr
Anexpressionthatchecksforanerrorcondition
andreturns
FALSEifanerrorhasoccurred.
func
Nameofthefunctionwheretheerroroccurred.
status
Codethatindicatesthetypeoferror(seeTable3-1,
iplError()StatusCodes.”)
Discussion
TheIPL_ASSERT()macrochecksfortheerrorcondition
expr
and sets the
errorstatus
IPL_StsInternaliftheerroroccurred.
The
IPL_ERRCHK()macrocheckstoseeifanerrorhasoccurredby
checkingtheerrorstatus.Ifanerrorhasoccurred,IPL_ERRCHK()creates
anerrorbacktracemessageandreturnsanon-zerovalue.Thismacro
shouldnormallybeusedafteranycalltoafunctionthatmighthave
signaledanerror.