Skip to content

Commit

Permalink
Log errors with stack traces.
Browse files Browse the repository at this point in the history
  • Loading branch information
arantius committed Nov 22, 2014
1 parent f39c743 commit 14d869f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/com/arantius/tivocommander/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ public final static void logError(String message) {
public final static void logError(String message, Throwable e) {
Log.e(LOG_TAG, message, e);
logAddToBuffer(message, "E");
logAddToBuffer(Log.getStackTraceString(e), "E");
}

public final static void logRpc(Object obj) {
Expand Down
30 changes: 15 additions & 15 deletions src/com/arantius/tivocommander/rpc/MindRpc.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,10 @@ public Boolean call() {
mInputStream = new DataInputStream(mSocket.getInputStream());
mOutputStream = new DataOutputStream(mSocket.getOutputStream());
} catch (UnknownHostException e) {
Log.e(LOG_TAG, "connect: unknown host!", e);
Utils.logError("connect: unknown host!", e);
return false;
} catch (IOException e) {
Log.e(LOG_TAG, "connect: io exception!", e);
Utils.logError("connect: io exception!", e);
return false;
}

Expand All @@ -226,10 +226,10 @@ public Boolean call() {
try {
return success.get();
} catch (InterruptedException e) {
Log.e(LOG_TAG, "connect: interrupted exception!", e);
Utils.logError("connect: interrupted exception!", e);
return false;
} catch (ExecutionException e) {
Log.e(LOG_TAG, "connect: execution exception!", e);
Utils.logError("connect: execution exception!", e);
return false;
}
}
Expand All @@ -254,17 +254,17 @@ private static SSLSocketFactory createSocketFactory(
context.init(fac.getKeyManagers(), tm, new SecureRandom());
return context.getSocketFactory();
} catch (CertificateException e) {
Log.e(LOG_TAG, "createSocketFactory: CertificateException!", e);
Utils.logError("createSocketFactory: CertificateException!", e);
} catch (IOException e) {
Log.e(LOG_TAG, "createSocketFactory: IOException!", e);
Utils.logError("createSocketFactory: IOException!", e);
} catch (KeyManagementException e) {
Log.e(LOG_TAG, "createSocketFactory: KeyManagementException!", e);
Utils.logError("createSocketFactory: KeyManagementException!", e);
} catch (KeyStoreException e) {
Log.e(LOG_TAG, "createSocketFactory: KeyStoreException!", e);
Utils.logError("createSocketFactory: KeyStoreException!", e);
} catch (NoSuchAlgorithmException e) {
Log.e(LOG_TAG, "createSocketFactory: NoSuchAlgorithmException!", e);
Utils.logError("createSocketFactory: NoSuchAlgorithmException!", e);
} catch (UnrecoverableKeyException e) {
Log.e(LOG_TAG, "createSocketFactory: UnrecoverableKeyException!", e);
Utils.logError("createSocketFactory: UnrecoverableKeyException!", e);
}
return null;
}
Expand All @@ -286,21 +286,21 @@ public void run() {
try {
mSocket.close();
} catch (IOException e) {
Log.e(LOG_TAG, "disconnect() socket", e);
Utils.logError("disconnect() socket", e);
}
}
if (mInputStream != null) {
try {
mInputStream.close();
} catch (IOException e) {
Log.e(LOG_TAG, "disconnect() input stream", e);
Utils.logError("disconnect() input stream", e);
}
}
if (mOutputStream != null) {
try {
mOutputStream.close();
} catch (IOException e) {
Log.e(LOG_TAG, "disconnect() output stream", e);
Utils.logError("disconnect() output stream", e);
}
}
}
Expand All @@ -310,7 +310,7 @@ public void run() {
try {
disconnectThread.join();
} catch (InterruptedException e) {
Log.e(LOG_TAG, "disconnect() interrupted exception", e);
Utils.logError("disconnect() interrupted exception", e);
}
}

Expand Down Expand Up @@ -461,7 +461,7 @@ private static String readPassword(Context ctx) {
try {
return reader.readLine();
} catch (IOException e) {
Log.e(LOG_TAG, "readpassword: IOException!", e);
Utils.logError("readpassword: IOException!", e);
return "";
}
}
Expand Down

0 comments on commit 14d869f

Please sign in to comment.