NativeDaemonConnector: Improve NativeDaemonException reporting to include the actual error response

Signed-off-by: San Mehat <san@google.com>
This commit is contained in:
San Mehat
2010-02-03 10:48:21 -08:00
parent 3c4a1ebc19
commit ec4caa0f54
2 changed files with 17 additions and 7 deletions

View File

@@ -22,6 +22,7 @@ package com.android.server;
public class NativeDaemonConnectorException extends RuntimeException
{
private int mCode = -1;
private String mCmd;
public NativeDaemonConnectorException() {}
@@ -30,13 +31,18 @@ public class NativeDaemonConnectorException extends RuntimeException
super(error);
}
public NativeDaemonConnectorException(int code, String error)
public NativeDaemonConnectorException(int code, String cmd, String error)
{
super(error);
super(String.format("Cmd {%s} failed with code %d : {%s}", cmd, code, error));
mCode = code;
mCmd = cmd;
}
public int getCode() {
return mCode;
}
public String getCmd() {
return mCmd;
}
}