404

[ Avaa Bypassed ]




Upload:

Command:

botdev@3.131.82.143: ~ $
import { Observable } from '../Observable';
import { SchedulerLike } from '../types';
import { Subscriber } from '../Subscriber';

/**
 * Creates an Observable that emits no items to the Observer and immediately
 * emits an error notification.
 *
 * <span class="informal">Just emits 'error', and nothing else.
 * </span>
 *
 * ![](throw.png)
 *
 * This static operator is useful for creating a simple Observable that only
 * emits the error notification. It can be used for composing with other
 * Observables, such as in a {@link mergeMap}.
 *
 * ## Examples
 * ### Emit the number 7, then emit an error
 * ```ts
 * import { throwError, concat, of } from 'rxjs';
 *
 * const result = concat(of(7), throwError(new Error('oops!')));
 * result.subscribe(x => console.log(x), e => console.error(e));
 *
 * // Logs:
 * // 7
 * // Error: oops!
 * ```
 *
 * ---
 *
 * ### Map and flatten numbers to the sequence 'a', 'b', 'c', but throw an error for 2
 * ```ts
 * import { throwError, interval, of } from 'rxjs';
 * import { mergeMap } from 'rxjs/operators';
 *
 * interval(1000).pipe(
 *   mergeMap(x => x === 2
 *     ? throwError('Twos are bad')
 *     : of('a', 'b', 'c')
 *   ),
 * ).subscribe(x => console.log(x), e => console.error(e));
 *
 * // Logs:
 * // a
 * // b
 * // c
 * // a
 * // b
 * // c
 * // Twos are bad
 * ```
 *
 * @see {@link Observable}
 * @see {@link empty}
 * @see {@link never}
 * @see {@link of}
 *
 * @param {any} error The particular Error to pass to the error notification.
 * @param {SchedulerLike} [scheduler] A {@link SchedulerLike} to use for scheduling
 * the emission of the error notification.
 * @return {Observable} An error Observable: emits only the error notification
 * using the given error argument.
 * @static true
 * @name throwError
 * @owner Observable
 */
export function throwError(error: any, scheduler?: SchedulerLike): Observable<never> {
  if (!scheduler) {
    return new Observable(subscriber => subscriber.error(error));
  } else {
    return new Observable(subscriber => scheduler.schedule(dispatch, 0, { error, subscriber }));
  }
}

interface DispatchArg {
  error: any;
  subscriber: Subscriber<any>;
}

function dispatch({ error, subscriber }: DispatchArg) {
  subscriber.error(error);
}

Filemanager

Name Type Size Permission Actions
dom Folder 0755
ConnectableObservable.ts File 5.42 KB 0644
SubscribeOnObservable.ts File 1.59 KB 0644
bindCallback.ts File 15.9 KB 0644
bindNodeCallback.ts File 15.41 KB 0644
combineLatest.ts File 21.95 KB 0644
concat.ts File 9.43 KB 0644
defer.ts File 2.53 KB 0644
empty.ts File 2.21 KB 0644
forkJoin.ts File 9.49 KB 0644
from.ts File 3.06 KB 0644
fromArray.ts File 423 B 0644
fromEvent.ts File 10.38 KB 0644
fromEventPattern.ts File 7.14 KB 0644
fromIterable.ts File 511 B 0644
fromObservable.ts File 485 B 0644
fromPromise.ts File 439 B 0644
generate.ts File 12.55 KB 0644
iif.ts File 3.22 KB 0644
interval.ts File 2.53 KB 0644
merge.ts File 9.94 KB 0644
never.ts File 1.16 KB 0644
of.ts File 4.77 KB 0644
onErrorResumeNext.ts File 3.83 KB 0644
pairs.ts File 3.06 KB 0644
partition.ts File 2.61 KB 0644
race.ts File 5.03 KB 0644
range.ts File 2.28 KB 0644
throwError.ts File 2.2 KB 0644
timer.ts File 3.32 KB 0644
using.ts File 3.04 KB 0644
zip.ts File 12.06 KB 0644