anon-10
February 26, 2019, 3:25am
1
This thread was migrated from an old forum. It may contain information that are no longer valid. For further assistance, please post a new question or open a support ticket from the Customer Support portal .
Hi,
I have set up an exception handler to handle crashes.
Now I want to see what exactly went wrong.
How can I see information about the crash (for example the information I normally see on the screen of my device when the app crashes in debug mode)??
Function I'm using is:
kony.lang.setUncaughtExceptionHandler(exception_handler);
function exception_handler(){
kony.print("App has crashed");
//some code to see or send the error
}
anon-11
February 26, 2019, 10:37pm
2
Hi @Emewson Pvwkew ,
Can you please provide steps to reproduce i.e. and the rest of the necessary information that is in this post:
https://basecamp.kony.com/s/article-detail/a046A00000ATlnKQAT/checklist-to-analyse-crashes-on-androidios-applications
Raising a support ticket would be better.
anon-11
February 27, 2019, 1:27am
3
It is not that my app is crashing but I just want to make a crashhandler which will send or show information if a crash occurs.
My question is about being able to get the stack trace information of the crash and doing something with it in the crashhandler function.
anon-11
February 27, 2019, 2:03am
4
@Emewson Pvwkew The answer is inside the question. Catch the error in the exception callback and either store it in the device or make a service call to store it on any server. If your application is using Fabric, you can check more than just crashes in Reports section.
anon-11
February 27, 2019, 2:08am
5
I'm trying to see what you mean, do you mean you can do something like this to for example print the error that occured???
kony.lang.setUncaughtExceptionHandler(exception_handler);
function exception_handler(error){
kony.print("App has crashed because of error: " + JSON.stringify(error));
}
Because when I do that I get an empty object:
App has crashed because of error: {}
anon-11
February 27, 2019, 2:13am
6
This should print the error as it has stringify. Can you try printing with the JavaScript example of uncaughtExceptionHandler from the doc?
http://docs.kony.com/konylibrary/visualizer/viz_api_dev_guide/content/kony.lang_functions.htm
anon-11
February 27, 2019, 2:17am
7
Ok I'm going to try it, thanx.
anon-11
February 27, 2019, 5:17am
8
Hi this function shows me a message, I do not see line, but at least I have an indication of what happened. Thanx a lot!
function uncaughtExceptionHandler(exceptionObject) {
// Converting exception object into a readable string
var exceptionString = "";
if("sourceURL" in exceptionObject){
exceptionString += exceptionObject.sourceURL;
}
if("line" in exceptionObject){
exceptionString += " line # " + exceptionObject.line;
}
if("message" in exceptionObject){
exceptionString += " : " + exceptionObject.message;
}
//Logging the exception string to console
kony.print("Unhandled Exception:" + exceptionString);
}
kony.lang.setUncaughtExceptionHandler(uncaughtExceptionHandler);
Hi all. What is the typical place I can call kony.lang.setUncaughtExceptionHandler?