mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-26 16:22:06 +01:00
Added getMessage() method, improved stack traces.
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2139 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
e5f76b3e40
commit
3451c8880d
1 changed files with 15 additions and 8 deletions
|
@ -172,9 +172,6 @@ public class XMPPException extends Exception {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void printStackTrace(PrintStream out) {
|
public void printStackTrace(PrintStream out) {
|
||||||
if (error != null) {
|
|
||||||
System.err.print(error + " -- ");
|
|
||||||
}
|
|
||||||
super.printStackTrace(out);
|
super.printStackTrace(out);
|
||||||
if (wrappedThrowable != null) {
|
if (wrappedThrowable != null) {
|
||||||
out.println("Nested Exception: ");
|
out.println("Nested Exception: ");
|
||||||
|
@ -183,9 +180,6 @@ public class XMPPException extends Exception {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void printStackTrace(PrintWriter out) {
|
public void printStackTrace(PrintWriter out) {
|
||||||
if (error != null) {
|
|
||||||
System.err.print(error + " -- ");
|
|
||||||
}
|
|
||||||
super.printStackTrace(out);
|
super.printStackTrace(out);
|
||||||
if (wrappedThrowable != null) {
|
if (wrappedThrowable != null) {
|
||||||
out.println("Nested Exception: ");
|
out.println("Nested Exception: ");
|
||||||
|
@ -193,11 +187,24 @@ public class XMPPException extends Exception {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
String msg = super.getMessage();
|
||||||
|
// If the message was not set, but there is an XMPPError, return the
|
||||||
|
// XMPPError as the message.
|
||||||
|
if (msg == null && error != null) {
|
||||||
|
return error.toString();
|
||||||
|
}
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
buf.append(super.toString());
|
String message = super.getMessage();
|
||||||
|
if (message != null) {
|
||||||
|
buf.append(message).append(": ");
|
||||||
|
}
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
buf.append(": ").append(error);
|
buf.append(error);
|
||||||
}
|
}
|
||||||
if (wrappedThrowable != null) {
|
if (wrappedThrowable != null) {
|
||||||
buf.append("\n -- caused by: ").append(wrappedThrowable);
|
buf.append("\n -- caused by: ").append(wrappedThrowable);
|
||||||
|
|
Loading…
Reference in a new issue