Disabling Hard-Error and Exception Messages

DosError disables or enables end-user notification of hard errors, program exceptions, or untrapped, numeric-processor exceptions.

In the following example, pop-up windows for hard errors and exceptions are disabled, then enabled again.

    #define INCL_DOSMISC   /* Error and exception values */
    #include <os2.h>


    /*************************************************/
    /* use pre-defined constants                     */
    /* FERR_DISABLEHARDERR   (0x00000000)            */
    /* FERR_ENABLEHARDERR    (0x00000001)            */
    /* FERR_ENABLEEXCEPTION  (0x00000000)            */
    /* FERR_DISABLEEXCEPTION (0x00000002)            */
    /* to create constants needed for DosError calls */
    /*************************************************/

    #define ENABLE_ERRORPOPUPS  FERR_ENABLEEXCEPTION | FERR_ENABLEHARDERR
    #define DISABLE_ERRORPOPUPS FERR_DISABLEEXCEPTION | FERR_DISABLEHARDERR

    APIRET ulrc;    /* Return code */

    ulrc = DosError(DISABLE_ERRORPOPUPS);   /* Action flag for disable */
    ulrc = DosError(ENABLE_ERRORPOPUPS);    /* Action flag for enable  */

The action to take is encoded as a binary flag. The following table shows the bit-values and their meanings.

Bit Values to Enable and Disable Hard-Error and Exception Pop-up Messages

┌─────┬─────┬──────────────────────────────────────────────────┐
│Bit  │Value│Meaning                                           │
├─────┼─────┼──────────────────────────────────────────────────┤
│0    │1    │Enables hard-error pop-up messages.               │
├─────┼─────┼──────────────────────────────────────────────────┤
│0    │0    │Disables hard-error pop-up messages.              │
├─────┼─────┼──────────────────────────────────────────────────┤
│1    │0    │Enables exception pop-up messages.                │
├─────┼─────┼──────────────────────────────────────────────────┤
│1    │1    │Disables exception pop-up messages.               │
└─────┴─────┴──────────────────────────────────────────────────┘
If DosError is not called, user notification for hard errors and exceptions is enabled by default.


[Back: Classifying Errors]
[Next: Exception Management]