File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change 19
19
20
20
import rx .Subscriber ;
21
21
import rx .exceptions .*;
22
- import rx .plugins .RxJavaHooks ;
22
+ import rx .plugins .* ;
23
23
24
24
/**
25
25
* {@code SafeSubscriber} is a wrapper around {@code Subscriber} that ensures that the {@code Subscriber}
@@ -146,8 +146,9 @@ public void onNext(T args) {
146
146
*
147
147
* @see <a href="https://github.com/ReactiveX/RxJava/issues/630">the report of this bug</a>
148
148
*/
149
+ @ SuppressWarnings ("deprecation" )
149
150
protected void _onError (Throwable e ) { // NOPMD
150
- RxJavaHooks . onError (e );
151
+ RxJavaPlugins . getInstance (). getErrorHandler (). handleError (e );
151
152
try {
152
153
actual .onError (e );
153
154
} catch (OnErrorNotImplementedException e2 ) { // NOPMD
Original file line number Diff line number Diff line change @@ -1084,4 +1084,25 @@ public Completable.Operator onLift(Completable.Operator lift) {
1084
1084
}
1085
1085
}
1086
1086
1087
+ @ Test
1088
+ public void noCallToHooksOnPlainError () {
1089
+
1090
+ final boolean [] called = { false };
1091
+
1092
+ RxJavaHooks .setOnError (new Action1 <Throwable >() {
1093
+ @ Override
1094
+ public void call (Throwable t ) {
1095
+ called [0 ] = true ;
1096
+ }
1097
+ });
1098
+
1099
+ try {
1100
+ Observable .error (new TestException ())
1101
+ .subscribe (new TestSubscriber <Object >());
1102
+
1103
+ assertFalse (called [0 ]);
1104
+ } finally {
1105
+ RxJavaHooks .reset ();
1106
+ }
1107
+ }
1087
1108
}
You can’t perform that action at this time.
0 commit comments