Debian Codegraph @

src/main/java/io/reactivex/rxjava3/exceptions/OnErrorNotImplementedException.java

raw
1 /*
2 * Copyright (c) 2016-present, RxJava Contributors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
5 * compliance with the License. You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software distributed under the License is
10 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
11 * the License for the specific language governing permissions and limitations under the License.
12 */
13
14 package io.reactivex.rxjava3.exceptions;
15
16 import io.reactivex.rxjava3.annotations.NonNull;
17
18 /**
19 * Represents an exception used to signal to the {@code RxJavaPlugins.onError()} that a
20 * callback-based subscribe() method on a base reactive type didn't specify
21 * an onError handler.
22 * <p>History: 2.0.6 - experimental; 2.1 - beta
23 * @since 2.2
24 */
25 public final class OnErrorNotImplementedException extends RuntimeException {
26
27 private static final long serialVersionUID = -6298857009889503852L;
28
29 /**
30 * Customizes the {@code Throwable} with a custom message and wraps it before it
31 * is signalled to the {@code RxJavaPlugins.onError()} handler as {@code OnErrorNotImplementedException}.
32 *
33 * @param message
34 * the message to assign to the {@code Throwable} to signal
35 * @param e
36 * the {@code Throwable} to signal; if null, a NullPointerException is constructed
37 */
38 public OnErrorNotImplementedException(String message, @NonNull Throwable e) {
39 super(message, e != null ? e : new NullPointerException());
40 }
41
42 /**
43 * Wraps the {@code Throwable} before it
44 * is signalled to the {@code RxJavaPlugins.onError()}
45 * handler as {@code OnErrorNotImplementedException}.
46 *
47 * @param e
48 * the {@code Throwable} to signal; if null, a NullPointerException is constructed
49 */
50 public OnErrorNotImplementedException(@NonNull Throwable e) {
51 this("The exception was not handled due to missing onError handler in the subscribe() method call. Further reading: https://github.com/ReactiveX/RxJava/wiki/Error-Handling | " + e, e);
52 }
53 }