Function 59h Get Extended Error

mov ah, 59h ;Get Extended Error

int 21h

cmp ax, 0 ;zero means no error

jz no_error

mov ExtError, ax ;extended-error value

mov ErrClass, bh ;error class

mov ErrAction, bl ;suggested action

mov ErrLocation, ch ;location of error

Get Extended Error (Function 59h) returns extended-error information, including the location where an error occurred and a suggested action, for the most recent MS-DOS Interrupt 21h function call.

Parameters

This function has no parameters.

Return Value

The carry flag is clear and the AX, BX, and CH registers contain the extended-error information. The AX register contains an extended-error value, the BH register contains the error class, the BL register contains the suggested action value, and the CH register contains the error-location value.

Comments

When MS-DOS processes this function, it alters all registers except SS:SP and CS:IP. A program should preserve the contents of any registers that will be needed after the function call.

For the table that contains the error values, see Appendix C, “Error Values.”

The error class may be one of the following:

Value Meaning

ERRCLASS_OUTRES (01h) Out of resource, such as storage.
ERRCLASS_TEMPSIT (02h) Not an error, but a temporary situation that is expected to end, such as a locked region in a file.
ERRCLASS_AUTH (03h) Authorization problem.
ERRCLASS_INTRN (04h) Internal error in system.
ERRCLASS_HRDFAIL (05h) Hardware failure.
ERRCLASS_SYSFAIL (06h) System software failure not the fault of the active program (caused by missing or incorrect configuration files, for example).
ERRCLASS_APPERR (07h) Application error.
ERRCLASS_NOTFND (08h) File or item not found.
ERRCLASS_BADFMT (09h) File or item with an invalid format or type.
ERRCLASS_LOCKED (0Ah) Interlocked file or item.
ERRCLASS_MEDIA (0Bh) Wrong disk in drive, bad spot on disk, or other storage-medium problem.
ERRCLASS_ALREADY (0Ch) Existing file or item.
ERRCLASS_UNK (0Dh) Unknown.

The suggested action may be one of the following:

Value Meaning

ERRACT_RETRY (01h) Retry immediately.
ERRACT_DLYRET (02h) Delay and retry.
ERRACT_USER (03h) Bad user input—get new values.
ERRACT_ABORT (04h) Terminate in an orderly manner.
ERRACT_PANIC (05h) Terminate immediately.
ERRACT_IGNORE (06h) Ignore the error.
ERRACT_INTRET (07h) Prompt the user to remove the cause of the error (to change disks, for example) and then retry.

The error location may be one of the following:

Value Location

ERRLOC_UNK (01h) Unknown
ERRLOC_DISK (02h) Random-access device, such as a disk drive
ERRLOC_NET (03h) Network
ERRLOC_SERDEV (04h) Serial device
ERRLOC_MEM (05h) Memory

See Also

Function 5D0Ah Set Extended Error