Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - __errcritical critical error status structure http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 __errcritical       Critical error status structure
------------------------------------------------------------------------------
 Declaration
   system.hdr

 Syntax
   _ECRIT __errcritical

 Default
   All members initialized to zero.

 Description
   The __errcritical structure stores status information for the last
   critical error.

   When the application's code contains a reference to the __errcritical
   variable, the runtime startup system installs a critical error handler
   for the program. Whenever a critical error occurs, the members of the
   __errcritical structure are filled with error information. The
   application may query the variable for error codes after any operation
   that might result in a critical error.

   The critical() function must not be called when the critical error handler
   associated with __errcritical is used in an application.

 Example
   #define EXAMPLE_SYSTEM
   #include example.hdr

   proc CheckCritical static
   if __errcritical.code
      alert( "Critical error;;" + ;
         "Error code " + istr( __errcritical.code ) + ";" + ;
         "Error class " + istr( __errcritical.class ) + ";" + ;
         "Error source " + istr( __errcritical.source ) + ";" + ;
         "Suggested action code " + istr( __errcritical.action ), ;
         " Abort ; Retry ; Ignore ; Fail ", RED_WHITE, BLACK_YELLOW )
      __errcritical.code := 0          // reset error code
   endif
   endproc
   
   proc Test_errcritical
   CheckCritical()
   type "b:nonsense.txt" // this results in a critical error if no B: drive
   CheckCritical()
   set printer to "LPT1"
   set print on
   ? "hello"       // this results in a critical error if printer is off
   CheckCritical()
   set print off
   ? "End of program"
   CheckCritical()
   endproc

   proc main
   Test_errcritical()
   endproc

See Also: critical()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson