Check a disc read/write error and recover from it.
──────────────────────────────────────────────────────────────────────────────

Syntax

bNewHandler := {|e| GT_ErrDisc(e, bOldHandler)}

Arguments:

e - Error object
bOldHandler - Previous Error Handler

Returns:

An array of three elements
Elem[1] := Error Message
Elem[2] := User Action
Elem[3] := Error number - useful if you want to
divert to another routine e.g. for formatting

Description:

Error handler for use with disc read/writes
to enable recovery from disc problems.
MUST Be Used within BEGIN SEQUENCE/END SEQUENCE construct

Examples:

FUNCTION DiscErr()
Local oOldHandler
Local nTries := 0
Local nAns
local aArrErr

// Set up the New handler and pass old handler as a parameter
bNewHandler := {|e| ErrDisc(e, bOldHandler)}
bOldHandler := ErrorBlock(bNewHandler)

WHILE (.t.)
BEGIN SEQUENCE

// Floppy disc access here
fopen('a:\missing.zxy')

//For low Level functions that don't normally use the
// error system
GT_LOWERR()

// This is the recovery section of the Begin/End Sequence
// construct. A BREAK statement got us to this point.
RECOVER USING aErrArr

// Allow the user three attempts
if nTries++ < 3
...
...
...
// Your recovery code
...
...
...
Do Case
Case nAns == 2
EXIT
Case nAns == 3
QUIT
EndCase
ENDIF
END SEQUENCE
ENDDO
RETURN NIL

Header File: GT_Lower.ch

Source: GT_DERR.PRG

Author: Niall Scott