guides:programming:programmers_reference_manual:rti_errortext

RTI_ErrorText Function

This function parses the REVERROR.DAT file to return error text strings for error codes.

ErrorText = RTI_ErrorText( ErrorType, ErrorCodes, Param1 )

The function has the following parameters:

ParameterDescription
ErrorType [Required]This specifies what type of error to return – can be one of the following:



• "FS" – (Filing System)

• "SP" – (Stored Procedure)

• "EV" – (Event)

• "HT" – (HashTable – RTP65)

• "WIN" – (Windows API and OleStatus() )

• "OS" – (Basic+ OS functions)

• _PURGE (Removes cached REVERROR.DAT data)



To retrieve the description for an FS error (i.e. an error code contained in the @File_Error variable) then ErrorType should be “FS”.



To retrieve the description for a standard SP error (i.e. an error code returned via Get_Status() ) then the ErrorType should be “SP”.



To retrieve the description for an Event error (i.e. an error code returned returned from Send_Event() or via Get_EventStatus()) then the ErrorType should be “EV”.



To retrieve the description for a hash-table error (i.e. an error code returned from RTP65() ) then the ErrorType should be “HT”.



To retrieve the description for a Windows API error, or an Ole error (i.e. an error code OleStatus() ) then the ErrorType should be “WIN”.



To retrieve the description for an Operating System error (i.e. an error code returned via Status() when using a Basic+ OS function like OsOpen and OSWrite) then the ErrorType should be “OS”.



To clear our any cached REVERROR.DAT data then ErrorType should be "_PURGE".
ErrorCodes [Required except for "FS","WIN" and "_PURGE" ErrorTypes]When retrieving an “FS” ErrorType this can be a @fm-delimited list of codes and replacement arguments in the same format as found in @File_Error. Alternatively it can be null and the error will be detected from the @File_Error variable.



When retrieving an “SP” ErrorType this parameter should be an @fm-delimited list of codes and replacement arguments in the same format as returned from Get_Status().



When retrieving an “EV” ErrorType this parameter should be an @fm-delimited list of codes and replacement arguments in the same format as returned from Get_EventStatus() or from Send_Event().



When retrieving an “HT” ErrorType this parameter should be an @fm-delimited of error codes in the format:



<0,1> RTP65 Status Code

<0,2> Table ID or Row ID (depends on the RTP65 method that raised the error)



When retrieving an “WIN” ErrorType this can be a single Windows Error code, or a code returned from the OleStatus() function. Alternatively it can be null and the error will be detected via the MsWin_GetLastError() function.



When retrieving an “OS” ErrorType this parameter should be an @fm-delimited of error codes in the format:



<0,1> Status() value

<0,2> OS File Name
Param1 [Optional]When retrieving an “WIN” ErrorType setting this parameter to TRUE$ swaps out any CarriageReturn and LineFeed characters with Spaces.

Returns an @fm-delimited list of error text strings for each error passed.

Because this function is used as part of the error handling mechanism no errors will be returned here. If the required error text cannot be obtained the raw code and arguments are returned instead.

When using the "FS" error type a call to Set_FSError() is made internally, so Get_Status() will return TRUE$ after RTI_ErrorText() returns. No error flags are cleared when using this function.

Declare Function RTI_ErrorText, Repository

   $Insert RTP65_Equates

   $Insert Logical

   * // Using with FS errors

   Open "MYTABLE" To hTable Then

      Read SomeRec From hTable, SomeID Else

         ErrorText = RTI_ErrorText( "FS", @File_Error )

      end

   end else

      ErrorText = RTI_ErrorText( "FS" ) ; * // Detect from @File_Error

   end

   * // Using with Get_Status() errors

   Call Set_Status( FALSE$ )

   MsgRec = Repository( "ACCESS", @AppID<1> : "*MSG**MYMSG" )

   If Get_Status( ErrorText ) then

      * // Use the information returned from Get_Status()

      ErrorText = RTI_ErrorText( "SP", ErrorText )

   end

   * // Using with Event errors

   EvError = Send_Event( @Window, "WRITE" )

   If Len( EvError ) Then

      ErrorText = RTI_ErrorText( "SP", EvError )

   End

   

   * // Using with RTP65

   htStatus = RTP65_NO_ERR$

   Call RTP65( RTP65_WRITE$, hTable, htID, htRec, "", htStatus )

   If ( htStatus <> RTP65_NO_ERR$ ) Then

      ErrorText = RTI_ErrorText( "HT", htStatus : @Vm : htID )

   End

   

   * // Used with OleStatus

   OleVal = SomeObj->SomeMethod( SomeArg1, SomeArg2 )

   If OleStatus() Then

      ErrorText = RTI_ErrorText( "WIN", OleStatus() )

   End

   

   * // Used with OS functions

   Status() = 0; FileName = "C:\Temp\Test.Txt"

   OSWrite SomeData To FileName

   If Status() Then

      ErrorText = RTI_ErrorText( "OS", Status() : @Vm : FileName )

   End
 
 
 
 
  • guides/programming/programmers_reference_manual/rti_errortext.txt
  • Last modified: 2024/06/19 20:20
  • by 127.0.0.1