sx_ErrorLevel

<< Click to Display Table of Contents >>

Navigation:  Apollo API Listing >

sx_ErrorLevel

VB Declaration

Declare Function sx_ErrorLevel Lib "Apollo9.dll"

(ByVal iErrorLevel As Integer)

As Integer

C Declaration

SHORT FAR PASCAL sx_ErrorLevel (SHORT iErrorLevel);

Description

Set which errors will be reported with message boxes. Two types of errors exist: Warnings and Fatal Errors. Warnings are errors that can be recovered from in code. An 1800 File Open Error is an example of a Warning. Fatal errors are unrecoverable. A 5000 Order Key Skip Error is an example of a Fatal Error.

Parameters

iErrorLevel: Any one of the following constant values:

 

ERRLEVEL_NONE  0 No error message at all.

ERRLEVEL_FATAL  1 Only report Fatal errors (Default).

ERRLEVEL_STANDARD 2 Report all errors.

Return Value

The iErrorlevel before the call to sx_ErrorLevel.

VB Example

' Implement our own error handling

Function OpenDbf( cFileName$, cAlias$ ) As Integer

Dim iOldErrLevel%

Dim iArea%, iRet%

 

iOldErrLevel = sx_ErrorLevel( ERRLEVEL_FATAL );

 

' Will not issue an error message on failure, but an error is still  

' reported through the return value.

 

iArea = sx_Use( cFilename, cAlias, EXCLUSIVE, SDENSX )

if iArea < 1 then

' Handle the error my way

MsgBox "Table not found"  

' Reset the error level

iRet = sx_ErrorLevel( iOldErrLevel )

end if

OpenDbf = iArea

End Function

C Example

//Implement our own error handling

int OpenDbf(BYTEP cpFilename, BYTEP cpAlias)

{

SHORT iOldErrLevel;

int iArea;

iOldErrLevel = sx_ErrorLevel(ERRLEVEL_FATAL);

 

// Will not issue an error message on failure, but an error is still  

// reported through the return value.

iArea = sx_Use(cpFilename, cpAlias, EXCLUSIVE, SDENSX);

if (!iArea)

{

//Handle the error my way

}

 

//Reset the error level

sx_ErrorLevel(iOldErrLevel);

return iArea;

}