Hello Robert or Chris,
how do I set an my own error handler inside the X# runtime (specifically the RDD) when using a Core dialect application?
To specify it better: I have a command line X# application that is called by the task scheduler in Windows and does something.
Therefore, when en exception occurs, no messagebox can be shown, but an email should be sent using a personalized exception handler.
The application is written in Core dialect and is using a VO dialect library to access DBF files.
Thank you very much!
Wolfgang
set exception handler inside the runtime
set exception handler inside the runtime
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
set exception handler inside the runtime
Hello Wolfgang,
At the end of the last session https://www.youtube.com/watch?v=qvbqxGt0zgQ I understood that a preprocessor script could take over global error handling (a bit like Ralph's error classes can do for VO).
On Robert's (large) to do list there is the promise that he will post a sample to do so, after my question.
Maybe that sample answers your question?
Dick
At the end of the last session https://www.youtube.com/watch?v=qvbqxGt0zgQ I understood that a preprocessor script could take over global error handling (a bit like Ralph's error classes can do for VO).
On Robert's (large) to do list there is the promise that he will post a sample to do so, after my question.
Maybe that sample answers your question?
Dick
set exception handler inside the runtime
Has everyone noticed that in the YouTube screenshot Robert looks like a pirate, with the Play icon on his left eye?
Dick
Dick
set exception handler inside the runtime
Hi Dick,
yes, I looked at that session on Youtube, but unfortunately it does not answers my question.
I already have an exception handler active in my application, but it is not called if any exception occurs inside the RDD classes.
So there must be any functionality to set an own error handler in the RDD classes.
Wolfgang
yes, I looked at that session on Youtube, but unfortunately it does not answers my question.
I already have an exception handler active in my application, but it is not called if any exception occurs inside the RDD classes.
So there must be any functionality to set an own error handler in the RDD classes.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
set exception handler inside the runtime
Hi Wolfgang,
You can just use ErrorBlock() and provide your own error handling. Something like
ErrorBlock({|oError| MyErrorHandler(oError)})
PROCEDURE MyErrorHandler(oError AS Exception)
? oError:ToString()
If your main exe is in Core and it does not know about codeblocks etc, you can do this in teh VO dialect library instead.
.
You can just use ErrorBlock() and provide your own error handling. Something like
ErrorBlock({|oError| MyErrorHandler(oError)})
PROCEDURE MyErrorHandler(oError AS Exception)
? oError:ToString()
If your main exe is in Core and it does not know about codeblocks etc, you can do this in teh VO dialect library instead.
.
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
set exception handler inside the runtime
Hi Chris,
thank you very much, I will try that.
Wolfgang
thank you very much, I will try that.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
set exception handler inside the runtime
Hi Chris,
maybe I'm stupid and don't see the wood because of the trees: but how I can do that?
My application is in Core dialect and does not knows about codeblocks, but the DLL knows about it (being in VO dialect).
But in case of an error e method of the main (Core dialect) application should be called.
How can I convert a function pointer passed from the application to a codeblock?
Wolfgang
maybe I'm stupid and don't see the wood because of the trees: but how I can do that?
My application is in Core dialect and does not knows about codeblocks, but the DLL knows about it (being in VO dialect).
But in case of an error e method of the main (Core dialect) application should be called.
How can I convert a function pointer passed from the application to a codeblock?
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
set exception handler inside the runtime
Hi Wolfgang,
I strongly recommend to look into MS Enterprise Library Exception Handling Block. The secret is to have different policies, depending on the environment, which actually handle the exception, without the need to handle this in your code, as you can incluence the setup of the exception handling by configuration.
Regards
Meinhard
I strongly recommend to look into MS Enterprise Library Exception Handling Block. The secret is to have different policies, depending on the environment, which actually handle the exception, without the need to handle this in your code, as you can incluence the setup of the exception handling by configuration.
Regards
Meinhard
set exception handler inside the runtime
Hi Meinhard,
I already have my error handlers in place.
My problem is how to make the X# runtime call my Core dialect error handler when there is a runtime error inside the X# runtime (specifically in the RDD).
Wolfgang
I already have my error handlers in place.
My problem is how to make the X# runtime call my Core dialect error handler when there is a runtime error inside the X# runtime (specifically in the RDD).
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
set exception handler inside the runtime
Hi Chris,
I think, I have found it (at least it works).
In my VO dialect library I have that static method:
and the relative call is that here:
whereas the called method is this one:
Wolfgang
I think, I have found it (at least it works).
In my VO dialect library I have that static method:
Code: Select all
static method SetExceptionHandler( oObject as object, cMethodName as string ) as void
ErrorBlock( {|o| Send( oObject, String2Symbol( cMethodName ), o ), _Break( o ) } )
return
Code: Select all
rdm.XbaseInterface.VOInterface.SetExceptionHandler( self, "ProcessExceptionRT" )
Code: Select all
method ProcessExceptionRT( oEx as Exception ) as void
self:WriteLog( oEx:Message )
self:WriteLog( oEx:StackTrace )
self:SendMail( "Fehler in BNBatchProcessor aufgetreten", oEx:Message, ProgSettings.ErrorMailTo, false )
return
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it