Skip to content

Commit ffb9e0e

Browse files
author
Matthias Radestock
committed
drop toString in favour of constructing a "message" for the super class
By setting the message we get better error reporting in apps that call getMessage() during error reporting rather than toString(). Clojure appears to be an example of this. And becasue the super class (RuntimeException) has a sensible toString method that takes into account the class name and message we do not our own toString method.
1 parent 0e81d5d commit ffb9e0e

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/com/rabbitmq/client/ShutdownSignalException.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ public ShutdownSignalException(boolean hardError,
6666
boolean initiatedByApplication,
6767
Object reason, Object ref)
6868
{
69+
super((initiatedByApplication
70+
? ("clean " + (hardError ? "connection" : "channel") + " shutdown")
71+
: ((hardError ? "connection" : "channel") + " error"))
72+
+ "; reason: " + reason);
6973
this._hardError = hardError;
7074
this._initiatedByApplication = initiatedByApplication;
7175
this._reason = reason;
@@ -88,13 +92,6 @@ public ShutdownSignalException(boolean hardError,
8892
/** @return Reference to Connection or Channel object that fired the signal **/
8993
public Object getReference() { return _ref; }
9094

91-
public String toString() {
92-
return super.toString() + " (" +
93-
(_initiatedByApplication
94-
? ("clean " + (_hardError ? "connection" : "channel") + " shutdown")
95-
: ((_hardError ? "connection" : "channel") + " error"))
96-
+ "; reason: " + _reason + ")";
97-
}
9895
}
9996

10097

0 commit comments

Comments
 (0)