Jump to content

DosErrClass (FAPI): Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
Ak120 (talk | contribs)
mNo edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 11: Line 11:


==Return Code==
==Return Code==
rc (USHORT) - return
;rc (USHORT) - return:Return code descriptions are:
Return code descriptions are:
* 0 NO_ERROR
* 0   NO_ERROR


==Remarks==
==Remarks==
Line 19: Line 18:


The following values are returned in Class, Action, and Locus:
The following values are returned in Class, Action, and Locus:
 
{|class="wikitable"
Class Definitions
|+Class Definitions
  VALUE     MNEMONIC     DESCRIPTION
!VALUE||MNEMONIC||DESCRIPTION
 
|-
  1         OUTRES       Out of resources
|1||OUTRES||Out of resources
  2         TEMPSIT     Temporary situation
|-
  3         AUTH         Authorization failed
|2||TEMPSIT||Temporary situation
  4         INTRN       Internal error
|-
  5         HRDFAIL     Device hardware failure
|3||AUTH||Authorization failed
  6         SYSFAIL     System failure
|-
  7         APPERR       Probable application error
|4||INTRN||Internal error
  8         NOTFND       Item not located
|-
  9         BADFMT       Bad format for call/data
|5||HRDFAIL||Device hardware failure
  10         LOCKED       Resource/data locked
|-
  11         MEDIA       Incorrect media, CRC error
|6||SYSFAIL||System failure
  12         ALREADY     Resource/action already taken/done/exists
|-
  13         UNK         Unclassified
|7||APPERR||Probable application error
  14         CANT         Can't perform requested action
|-
  15         TIME         Timeout
|8||NOTFND||Item not located
 
|-
Action Definitions
|9||BADFMT||Bad format for call/data
  VALUE     MNEMONIC     DESCRIPTION
|-
|10||LOCKED||Resource/data locked
  1         RETRY       Retry immediately
|-
  2         DLYRET       Delay and retry
|11||MEDIA||Incorrect media, CRC error
  3         USER         Bad user input - get new values
|-
  4         ABORT       Terminate in an orderly manner
|12||ALREADY||Resource/action already taken/done/exists
  5         PANIC       Terminate immediately
|-
  6         IGNORE       Ignore error
|13||UNK||Unclassified
  7         INTRET       Retry after user intervention
|-
 
|14||CANT||Can't perform requested action
Locus Definitions
|-
  VALUE     MNEMONIC     DESCRIPTION
|15||TIME||Timeout
|}
  1         UNK         Unknown
{|class="wikitable"
  2         DISK         Random access device such as a disk
|+Action Definitions
  3         NET         Network
!VALUE||MNEMONIC||DESCRIPTION
  4         SERDEV       Serial device
|-
  5         MEM         Memory
|1||RETRY||Retry immediately
|-
|2||DLYRET||Delay and retry
|-
|3||USER||Bad user input - get new values
|-
|4||ABORT||Terminate in an orderly manner
|-
|5||PANIC||Terminate immediately
|-
|6||IGNORE||Ignore error
|-
|7||INTRET||Retry after user intervention
|}
{|class="wikitable"
|+Locus Definitions
!VALUE||MNEMONIC||DESCRIPTION
|-
|1||UNK||Unknown
|-
|2||DISK||Random access device such as a disk
|-
|3||NET||Network
|-
|4||SERDEV||Serial device
|-
|5||MEM||Memory
|}


===Family API Considerations===
===Family API Considerations===
Line 64: Line 90:
When DosErrClass is called by a family application, it returns a valid error classification for returns that have occurred. The classifications of a given return code may not be the same for the Family API and the OS/2 mode applications.  
When DosErrClass is called by a family application, it returns a valid error classification for returns that have occurred. The classifications of a given return code may not be the same for the Family API and the OS/2 mode applications.  


==Example Code==
==Bindings==
===C Binding===
===C===
<PRE>
<PRE>
#define INCL_DOSMISC
#define INCL_DOSMISC
Line 71: Line 97:
USHORT  rc = DosErrClass(Code, Class, Action, Locus);
USHORT  rc = DosErrClass(Code, Class, Action, Locus);


USHORT           Code;          /* Error code for analysis */
USHORT Code;          /* Error code for analysis */
PUSHORT         Class;        /* Error classification (returned) */
PUSHORT Class;        /* Error classification (returned) */
PUSHORT         Action;        /* Recommended action (returned) */
PUSHORT Action;        /* Recommended action (returned) */
PUSHORT         Locus;        /* Error locus (returned) */
PUSHORT Locus;        /* Error locus (returned) */
 
USHORT  rc;            /* return code */
</PRE>
 
===MASM===
<PRE>
EXTRN  DosErrClass:FAR
INCL_DOSMISC      EQU 1
 
PUSH  WORD    Code      ;Error code for analysis
PUSH@  WORD    Class    ;Error classification (returned)
PUSH@  WORD    Action    ;Recommended action (returned)
PUSH@  WORD    Locus    ;Error locus (returned)
CALL  DosErrClass


USHORT          rc;            /* return code */
Returns WORD
</PRE>
</PRE>
This example attempts to delete a non-existent file. The error returned is then plugged into DosErrClass for more information about the error and what actions should be taken.  
 
==Example Code==
This example attempts to delete a non-existent file. The error returned is then plugged into DosErrClass for more information about the error and what actions should be taken.
<PRE>
<PRE>
#define INCL_DOSQUEUES
#define INCL_DOSQUEUES
Line 91: Line 133:
USHORT rc;
USHORT rc;


   Error = DosDelete(FILE_DELETE,     /* File name path */
   Error = DosDelete(FILE_DELETE, /* File name path */
                     RESERVED);       /* Reserved (must be zero) */
                     RESERVED);   /* Reserved (must be zero) */
   rc = DosErrClass(Error,             /* Error code for analysis */
   rc = DosErrClass(Error,         /* Error code for analysis */
                     &Class,           /* Error classification */
                     &Class,       /* Error classification */
                     &Action,           /* Recommended action */
                     &Action,       /* Recommended action */
                     &Locus);           /* Error locus */
                     &Locus);       /* Error locus */
</PRE>
 
===MASM Binding===
<PRE>
EXTRN  DosErrClass:FAR
INCL_DOSMISC      EQU 1
 
PUSH  WORD    Code          ;Error code for analysis
PUSH@  WORD    Class        ;Error classification (returned)
PUSH@  WORD    Action        ;Recommended action (returned)
PUSH@  WORD    Locus        ;Error locus (returned)
CALL  DosErrClass
 
Returns WORD
</PRE>
</PRE>
==Related Functions==
*


[[Category:Dos]]
[[Category:Dos16]]

Latest revision as of 02:05, 26 January 2020

This call helps OS/2 applications respond to error codes (return codes) received from OS/2.

Syntax

DosErrClass (Code, Class, Action, Locus)

Parameters

Code (USHORT) - input
Error code returned by an OS/2 function.
Class (PUSHORT) - output
Address of the classification of an error.
Action (PUSHORT) - output
Address of the action for an error.
Locus (PUSHORT) - output
Address of the origin of an error.

Return Code

rc (USHORT) - return
Return code descriptions are:
  • 0 NO_ERROR

Remarks

The input is a return code returned from another function call, and the output is a classification of the return and recommended action. Depending on the application, the recommended action could be followed, or a more specific application recovery could be performed.

The following values are returned in Class, Action, and Locus:

Class Definitions
VALUE MNEMONIC DESCRIPTION
1 OUTRES Out of resources
2 TEMPSIT Temporary situation
3 AUTH Authorization failed
4 INTRN Internal error
5 HRDFAIL Device hardware failure
6 SYSFAIL System failure
7 APPERR Probable application error
8 NOTFND Item not located
9 BADFMT Bad format for call/data
10 LOCKED Resource/data locked
11 MEDIA Incorrect media, CRC error
12 ALREADY Resource/action already taken/done/exists
13 UNK Unclassified
14 CANT Can't perform requested action
15 TIME Timeout
Action Definitions
VALUE MNEMONIC DESCRIPTION
1 RETRY Retry immediately
2 DLYRET Delay and retry
3 USER Bad user input - get new values
4 ABORT Terminate in an orderly manner
5 PANIC Terminate immediately
6 IGNORE Ignore error
7 INTRET Retry after user intervention
Locus Definitions
VALUE MNEMONIC DESCRIPTION
1 UNK Unknown
2 DISK Random access device such as a disk
3 NET Network
4 SERDEV Serial device
5 MEM Memory

Family API Considerations

Some options operate differently in the DOS mode than in the OS/2 mode. Therefore, the following considerations apply to DosErrClass when coding for the DOS mode:

When DosErrClass is called by a family application, it returns a valid error classification for returns that have occurred. The classifications of a given return code may not be the same for the Family API and the OS/2 mode applications.

Bindings

C

#define INCL_DOSMISC

USHORT  rc = DosErrClass(Code, Class, Action, Locus);

USHORT  Code;          /* Error code for analysis */
PUSHORT Class;         /* Error classification (returned) */
PUSHORT Action;        /* Recommended action (returned) */
PUSHORT Locus;         /* Error locus (returned) */

USHORT  rc;            /* return code */

MASM

EXTRN  DosErrClass:FAR
INCL_DOSMISC      EQU 1

PUSH   WORD    Code      ;Error code for analysis
PUSH@  WORD    Class     ;Error classification (returned)
PUSH@  WORD    Action    ;Recommended action (returned)
PUSH@  WORD    Locus     ;Error locus (returned)
CALL   DosErrClass

Returns WORD

Example Code

This example attempts to delete a non-existent file. The error returned is then plugged into DosErrClass for more information about the error and what actions should be taken.

#define INCL_DOSQUEUES

#define RESERVED 0L
#define FILE_DELETE "adlkjf.dkf"

USHORT Error;
USHORT Class;
USHORT Action;
USHORT Locus;
USHORT rc;

   Error = DosDelete(FILE_DELETE,  /* File name path */
                     RESERVED);    /* Reserved (must be zero) */
   rc = DosErrClass(Error,         /* Error code for analysis */
                    &Class,        /* Error classification */
                    &Action,       /* Recommended action */
                    &Locus);       /* Error locus */