Parse.com - Logging Caught Exceptions - android

Can we send caught errors to Parse.com bugs dashboard like this example from Crashlytics
try {
myMethodThatThrows();
} catch (Exception e) {
Crashlytics.logException(e);
// handle your exception here!
}

Are you looking for Parse Crash Reporting?

Related

smack error when trying to login on server

public void login() {
try {
connection.login(loginUser, passwordUser);
Log.i("LOGIN", "Yey! We're connected to the XMPP server!");
} catch (XMPPException e) {
e.printStackTrace();
} catch (SmackException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
catch (Exception e) {
Log.i("login fuction","login error");
e.printStackTrace();
}
}
[eclipse error log]
I'm getting an error at this stage after successful connection to the server
i don't have the privilege to comment but from the input that you have given here the error possibly lies in the login function that is throwing the null point exception
Possible cases
1) When you call instance method on a null object. you won't get null pointer exception if you call static method or class method on null object because static method doesn't require an instance to call any method.
2) While accessing or changing any variable or field on null object.
3) Throwing null when an Exception is expected to throw.
4) When calling length of array when array is null.
5) Accessing or changing slots of null just like an array.
6) When you try to synchronize on null object or using null inside synchronized block in Java
give the code for login function for further help
Hope this helps you
Which server are you calling? If you are calling gtalk or fchat, those have stopped using xmpp. You may search in Google to find out. And if you plan to connect to you own ip server, please use xmpptc. It would be nice if you could give some more of your code.
I've finally found the solution, i had to add smack-java7 in my dependencies

how to send report to Acralyzer manual

I am using Acralyzer for reporting of errors (Crash reports)
Now I want to manually send a Custom report to Acra.
But do not know , how to do ?
Try this:
try
{
// some code
}
catch (Exception e) {
ErrorReporter.getInstance().handleException(e);
}

How to configure logger used for "Exception handlers should provide some context and preserve the original exception" issue?

I get this issue:
"Exception handlers should provide some context and preserve the original exception"
On code like this:
catch (IOException e) {
Log.e(AnkiDroidApp.TAG, "<actual message here");
}
How can I tell to Sonar that our logger isn't Logger, but Log?
Turns out i misunderstood the complaint of Sonar. It was not expecting a specific name for the logger, but for the code to send both the message AND the exception itself to the logger, like so:
catch (IOException e) {
Log.e(AnkiDroidApp.TAG, "<actual message here", e);
}

HttpHostConnectException - How can I catch it right?

I have a HttpHostConnectException... That is okay, because the server is offline. So I want to mange to catch this exception for the situation, the server will be down.
But if I use
catch (HttpHostConnectException e){
e.printStackTrace();
}
Nothing happens and the exception will be kill the progess. So how can I catch "unreachable" servers? Thank your for your time and help ;)
Calling e.printStackTrace(); will Kill your app as the exception is not handled
e.printStackTrace(); will print the exception on to the logcat and Will show an error or will crash you app
Either you can display the exception as string or Make static text as toast saying server unreachable
catch (HttpHostConnectException e)
{
Toast.makeText(getApplicationContext(), "Server Unreachable ", Toast.LENGTH_LONG).show();
}
if you want to show what was the actual problem / exception that was caused use
catch (HttpHostConnectException e)
{
Toast.makeText(getApplicationContext(), "Connection Timeout Reason "+string.ValueOf(e), Toast.LENGTH_LONG).show();
}
By doing this your app will not kill itself and proceed to the next line of your code
you can also do this
Log.v(locat, exception.toString());

How to catch Amazon AWS errors Android

I am constantly getting error reports (from users) such as:
Caused by: Status Code: 400, AWS Service: AmazonSimpleDB, AWS Request ID: c5cb109d-bbff-fcea-bc0d-0cb60ff8f6af, AWS Error Code: RequestExpired, AWS Error Message: Request has expired. Timestamp date is 2012-06-06T13:19:59.415Z. Current date is 2012-06-06T14:20:03Z
Apparently this is because the user has the wrong timezone or something set? Regardless, I would like to catch this particular error and post a message to the user asking them to check their timezone settings however I can't find a way to do it. If I catch AmazonServiceException, the error shows up as null.
How can I catch errors based on Status Code or even Error Code? The current code that I tried looks like this:
try {
dostuff()
} catch (IOException e) {
updateAWS("DownloadErrors");
return "filenotfound";
} catch (AmazonServiceException e) {
return "downloadfail";
}
However AmazonServiceException e is always null so I can't pull any information from it.
other code:
private void doStuff() throws IOException, AmazonServiceException{
//code here
}
Apparently this is what I needed. SDb tracks "RequestExpired" and S3 uses "RequestTimeTooSkewed"
Also, this appears to be occurring because the system time is >15 minutes different than the AWS server. I put a note to the user to check their time and use "Automatic" date/time if possible. Tested it myself and reproduced the error as well as the solution.
try {
result = doOperations();
} catch (AmazonServiceException e) {
if (e.getErrorCode().equals("RequestExpired") || e.getErrorCode().equals("RequestTimeTooSkewed")) {
result = "timestamp";
}
}
return result;
}

Categories

Resources