I have a global method that I call in the onError event. Is there a way to find out which method/line caused the exception?
xtsr:
I have a global method that I call in the onError event. Is there a way to find out which method/line caused the exception?
It depends on the type of the error. If the java exception contains this info, it can be retrived. So, what type is your error ? If you try, exception.getLineNumber() , does it work ?
If possible, it should work in any case. In this particular case it was a DataException:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘’ at line 1
The error occurred when using databaseManager.getDataSetByQuery. Before executing the query, I store it in a global variable and log it if the above error occurs. This way I at least find out which query caused the error. However, having the caller of a method available would help debugging the application.
for rhino exceptions you have getScriptStackTrace()
But for DataException (ServoyExceptions) you cant get to the script stack. Also because there doesnt have to be one… (it could be generated from the UI)