Hi
I use RegisterExceptionHandler(frmMain.ExceptionFilter, stTrySyncCallOnSuccess); and use my own implementation when an exception occur.
This all works great and my question is, whether I can add a variable value to the report so as an addition to the report itself, I want to know the content of a specific variable so I will know the context of the exception.
Thanks
Add a variable value when exception
Re: Add a variable value when exception
Sorry for the late reply.
in your "frmMain.ExceptionFilter" handler you can do "exceptIntf.BugReportHeader['yourVariable'] := yourVariable;".
Does that do what you need?
in your "frmMain.ExceptionFilter" handler you can do "exceptIntf.BugReportHeader['yourVariable'] := yourVariable;".
Does that do what you need?
Re: Add a variable value when exception
The thing is I have 10 threads (same thread running 10 times each time with a specific code) and if one of them fails, I want to know the code that failed.
If I understand correctly, the exception is running on the main thread so I need a way to catch the code from the thread and somehow send it to the exception handler
If I understand correctly, the exception is running on the main thread so I need a way to catch the code from the thread and somehow send it to the exception handler
Re: Add a variable value when exception
Unfortunately that's more complicated than it sounds. Exception handling runs in its own private thread. However, you can use "exceptIntf.CrashedThreadId" to ask which thread (ID) crashed. I'm not sure if that's enough information for your needs? If not, I suppose you could create a global thread storage (properly synchronized with critical sections, of course) in which you would store information per thread, so in your exception handler you could then extract the information you need from the global thread storage, by using the CrashedThreadId.