source: trip-planner-front/node_modules/rxjs/internal/observable/throwError.d.ts@ eed0bf8

Last change on this file since eed0bf8 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.8 KB
Line 
1import { Observable } from '../Observable';
2import { SchedulerLike } from '../types';
3/**
4 * Creates an Observable that emits no items to the Observer and immediately
5 * emits an error notification.
6 *
7 * <span class="informal">Just emits 'error', and nothing else.
8 * </span>
9 *
10 * ![](throw.png)
11 *
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}.
15 *
16 * ## Examples
17 * ### Emit the number 7, then emit an error
18 * ```ts
19 * import { throwError, concat, of } from 'rxjs';
20 *
21 * const result = concat(of(7), throwError(new Error('oops!')));
22 * result.subscribe(x => console.log(x), e => console.error(e));
23 *
24 * // Logs:
25 * // 7
26 * // Error: oops!
27 * ```
28 *
29 * ---
30 *
31 * ### Map and flatten numbers to the sequence 'a', 'b', 'c', but throw an error for 2
32 * ```ts
33 * import { throwError, interval, of } from 'rxjs';
34 * import { mergeMap } from 'rxjs/operators';
35 *
36 * interval(1000).pipe(
37 * mergeMap(x => x === 2
38 * ? throwError('Twos are bad')
39 * : of('a', 'b', 'c')
40 * ),
41 * ).subscribe(x => console.log(x), e => console.error(e));
42 *
43 * // Logs:
44 * // a
45 * // b
46 * // c
47 * // a
48 * // b
49 * // c
50 * // Twos are bad
51 * ```
52 *
53 * @see {@link Observable}
54 * @see {@link empty}
55 * @see {@link never}
56 * @see {@link of}
57 *
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.
63 * @static true
64 * @name throwError
65 * @owner Observable
66 */
67export declare function throwError(error: any, scheduler?: SchedulerLike): Observable<never>;
Note: See TracBrowser for help on using the repository browser.