Refined event logic to prevent multiple error messages from being displayed. Imlemented GetStackTrace service in Error_Services so that the stack contents can be logged with the RDS Layer error log.

This commit is contained in:
Infineon\StieberD
2025-03-21 13:54:43 -07:00
committed by Stieber Daniel (CSC FI SPS MESLEO)
parent 651b7ab420
commit f930fd3efe
6 changed files with 543 additions and 1079 deletions

View File

@ -102,7 +102,7 @@ If Assigned(Response) else Response = ''
AutoDisplayErrors = False$ ; // Set this to True$ when debugging so all errors will automatically display.
Declare function RetStack, Error_Services, SRPSendMail, Get_Env
Declare subroutine Error_Services, Set_Env, Set_Status
Declare subroutine Error_Services, Set_Env, Set_Status, GetTempPath
GoToService else
Error_Services('Set', Service : ' is not a valid service request within the Error services module.')
@ -311,16 +311,39 @@ Service GetCodes()
End Service
//----------------------------------------------------------------------------------------------------------------------
// GetStackTrace
//
// Uses a debugger intercept to log the stack including line numbers to a temporary file and returns the contents
// in the Response variable.
//
// Warning:
// Stepping into this while debugging will interrupt the debugging session and may cause an error message to
// be displayed. It is advised to set a breakpoint after the call and let the debugger run through this.
//----------------------------------------------------------------------------------------------------------------------
Service GetStackTrace()
// Business logic goes here. Data that needs to be returned should be assigned to the Response parameter.
Response = '<Service Response>'
Error_Services('LogStack')
TempLogFileName = 'OIStackLog.csv'
TempDirectory = Str(\00\, 1024)
GetTempPath(Len(TempDirectory), TempDirectory)
Convert \00\ to '' in TempDirectory
TempLogPath = TempDirectory:TempLogFileName
OSRead Response from TempLogpath else
Error_Services('Add', 'Error in ':Service:' service. Error retrieving OIStackLog.csv')
end
End Service
//----------------------------------------------------------------------------------------------------------------------
// LogStack
//
// Uses a custom debugger intercept to log the stack including line numbers to .../LogFiles/StackTrace.
// Uses a debugger intercept, DEBUGGER_LOGGER, to log the stack including line numbers to .../LogFiles/StackTrace.
//
// Warning:
// Stepping into this while debugging will interrupt the debugging session and may cause an error message to
// be displayed. It is advised to set a breakpoint after the call and let the debugger run through this.
//----------------------------------------------------------------------------------------------------------------------
Service LogStack()
@ -402,3 +425,4 @@ SendRuntimeAlert:
MsgSent = SRPSendMail(Message, ConfigFile)
return