Skip to content

Commit 7c5b158

Browse files
Merge pull request #315 from benjchristensen/onError-to-throwable
Change onError(Exception) to onError(Throwable) - Issue #296
2 parents 7c04f6b + 5316bcc commit 7c5b158

File tree

61 files changed

+848
-633
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+848
-633
lines changed

rxjava-core/src/main/java/rx/Notification.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
public class Notification<T> {
2424

2525
private final Kind kind;
26-
private final Exception exception;
26+
private final Throwable throwable;
2727
private final T value;
2828

2929
/**
@@ -34,7 +34,7 @@ public class Notification<T> {
3434
*/
3535
public Notification(T value) {
3636
this.value = value;
37-
this.exception = null;
37+
this.throwable = null;
3838
this.kind = Kind.OnNext;
3939
}
4040

@@ -44,8 +44,8 @@ public Notification(T value) {
4444
* @param exception
4545
* The exception passed to the onError notification.
4646
*/
47-
public Notification(Exception exception) {
48-
this.exception = exception;
47+
public Notification(Throwable exception) {
48+
this.throwable = exception;
4949
this.value = null;
5050
this.kind = Kind.OnError;
5151
}
@@ -54,18 +54,18 @@ public Notification(Exception exception) {
5454
* A constructor used to represent an onCompleted notification.
5555
*/
5656
public Notification() {
57-
this.exception = null;
57+
this.throwable = null;
5858
this.value = null;
5959
this.kind = Kind.OnCompleted;
6060
}
6161

6262
/**
6363
* Retrieves the exception associated with an onError notification.
6464
*
65-
* @return The exception associated with an onError notification.
65+
* @return Throwable associated with an onError notification.
6666
*/
67-
public Exception getException() {
68-
return exception;
67+
public Throwable getThrowable() {
68+
return throwable;
6969
}
7070

7171
/**
@@ -91,8 +91,8 @@ public boolean hasValue() {
9191
*
9292
* @return a value indicating whether this notification has an exception.
9393
*/
94-
public boolean hasException() {
95-
return isOnError() && exception != null;
94+
public boolean hasThrowable() {
95+
return isOnError() && throwable != null;
9696
}
9797

9898
/**
@@ -125,8 +125,8 @@ public String toString() {
125125
StringBuilder str = new StringBuilder("[").append(super.toString()).append(" ").append(getKind());
126126
if (hasValue())
127127
str.append(" ").append(getValue());
128-
if (hasException())
129-
str.append(" ").append(getException().getMessage());
128+
if (hasThrowable())
129+
str.append(" ").append(getThrowable().getMessage());
130130
str.append("]");
131131
return str.toString();
132132
}
@@ -136,8 +136,8 @@ public int hashCode() {
136136
int hash = getKind().hashCode();
137137
if (hasValue())
138138
hash = hash * 31 + getValue().hashCode();
139-
if (hasException())
140-
hash = hash * 31 + getException().hashCode();
139+
if (hasThrowable())
140+
hash = hash * 31 + getThrowable().hashCode();
141141
return hash;
142142
}
143143

@@ -154,7 +154,7 @@ public boolean equals(Object obj) {
154154
return false;
155155
if (hasValue() && !getValue().equals(notification.getValue()))
156156
return false;
157-
if (hasException() && !getException().equals(notification.getException()))
157+
if (hasThrowable() && !getThrowable().equals(notification.getThrowable()))
158158
return false;
159159
return true;
160160
}

0 commit comments

Comments
 (0)