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 - imessage() return the message associated with a runtime error http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 imessage()          Return the message associated with a runtime error
------------------------------------------------------------------------------
 Declaration
   system.hdr

 Syntax
   func char imessage extern
   param value uint uErrorNumber

 Arguments
   uErrorNumber is the

 Return
   An error message string.

 Description
   The imessage() function returns the message associated with the given
   runtime uErrorNumber. If a runtime error occurs and an error procedure
   has not been set through the on error do command, only the runtime error
   number is printed on the screen without any formatting.

   You may call imessage() from your own error handler to display the
   associated error message instead of just the error number.

   If the imessage() function is linked with an application, the resulting
   code size increases by about 3 Kbytes because all text constants containing
   the available error messages are linked as well.

 Example
   #define EXAMPLE_SYSTEM
   #include example.hdr

   // This application prints the error message associated with the error
   // number passed on the command line, or presents a list of all error
   // messages if no command line argument is given
   
   proc ErrorList static
   // Print a listing of the Force runtime error codes.
   vardef
      _SLIST pList
      char   cErrMsg
      uint   n
   enddef
   @ 1, 32 ?? "Force runtime errors"
   n := 256
   pList := pickinit()
   do while .t.
      cErrMsg := imessage( n )
      if squish( cErrMsg ) == "nomessageforthiserrorcode"
         exit
      endif
      if .not. isempty( cErrMsg )
         pickadd( pList, istr( n ) + " " + cErrMsg )
      endif
      n++
   enddo
   setcolors( CYAN_BLUE, BLUE_YELLOW, 0 )
   @ 3, 9 to 21, 71
   pickdisp( pList, 4, 10, 20, 70 )
   pickclear( pList )
   endproc
   
   proc Test_imessage
   if argc()
      ? "Error", argv( 1 ) + ":", imessage( ival( argv( 1 ) ) )
   else
      ErrorList()
   endif
   endproc

   proc main
   Test_imessage()
   endproc

See Also: __errcode emessage() on error do

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