We use a global method to handle all errors that occur in the solution.
If an error occurs we create a record in a logtable so we’ll be able to get a better idea of what a user runs into.
We already store information about the context (forms/mode/record id etc. ) the solution was in when the error occurred.
An even better logging could be achieved if we could have a look at the method stack at that particular moment.
Is there any chance this info can be retrieved?
but this will not work for all kind of exceptions you could get.
i could add for 6 also that one for ServoyExceptions, but that will not give back the script stack as above (that info is only there in script exceptions)
jcompagner:
so with the first you get the actual script stack trace and with the second the java full blown stacktrace.
blow me away!
Just implemented the first part and that gives me already good detailed information.
Please remind me to implement the new stuff in 6 once it’s released…
mboegem:
Just implemented the first part and that gives me already good detailed information.
Now that I’m running this code in smartclient I don’t get the stacktrace returned using ex.getScriptStackTrace();.
When I run the same method including error in debug client it works fine.
Is this expected behaviour or did I miss something?
i guess we are then in compiled mode and rhino can’t then give you that information.
i guess the stack trace that you maybe see in the log has those “c1” (or c2, any number) classes in its trace?
This is what the debug client returns on the error:
org.mozilla.javascript.EcmaError: ReferenceError: “x” is not defined. (C:\Servoy_All\Workspaces\5.0.0_dev\navigation\globals.js#664)
at C:\Servoy_All\Workspaces\5.0.0_dev\navigation\globals.js:664 (nav_dc_add)
at C:\Servoy_All\Workspaces\5.0.0_dev\crm\forms\Address_methods.js:190 (onSort)
at C:\Servoy_All\Workspaces\5.0.0_dev\crm\forms\Address_stbl.js:16 (onSort)
Anyway, it would be very nice to have this kind of information returned in normal clients as well.
This will help a lot to find out where the user went wrong.
A lot of our methods are called from other methods, this can be numberous levels deep. Every level of course depending on its own arguments.
Is there a way to get the method call stack at any given moment at runtime without throwing an error?
I’d like to log the stack trace when I audit fields in my app but I’m not sure how to get it (he script stack trace, not java).