1 import { Observable } from '../Observable';
2 import { SchedulerLike } from '../types';
4 * Creates an Observable that emits no items to the Observer and immediately
5 * emits an error notification.
7 * <span class="informal">Just emits 'error', and nothing else.
12 * This static operator is useful for creating a simple Observable that only
13 * emits the error notification. It can be used for composing with other
14 * Observables, such as in a {@link mergeMap}.
17 * ### Emit the number 7, then emit an error
19 * import { throwError, concat, of } from 'rxjs';
21 * const result = concat(of(7), throwError(new Error('oops!')));
22 * result.subscribe(x => console.log(x), e => console.error(e));
31 * ### Map and flatten numbers to the sequence 'a', 'b', 'c', but throw an error for 2
33 * import { throwError, interval, of } from 'rxjs';
34 * import { mergeMap } from 'rxjs/operators';
36 * interval(1000).pipe(
37 * mergeMap(x => x === 2
38 * ? throwError('Twos are bad')
41 * ).subscribe(x => console.log(x), e => console.error(e));
53 * @see {@link Observable}
58 * @param {any} error The particular Error to pass to the error notification.
59 * @param {SchedulerLike} [scheduler] A {@link SchedulerLike} to use for scheduling
60 * the emission of the error notification.
61 * @return {Observable} An error Observable: emits only the error notification
62 * using the given error argument.
67 export declare function throwError(error: any, scheduler?: SchedulerLike): Observable<never>;