work.suroh.tk/node_modules/rxjs/operator/catch.js.map

1 line
2.5 KiB
Plaintext

{"version":3,"file":"catch.js","sourceRoot":"","sources":["../../src/operator/catch.ts"],"names":[],"mappings":";AAEA,2BAA0C,yBAAyB,CAAC,CAAA;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,gBAAkD,QAAiE;IACjH,MAAM,CAAC,uBAAW,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC;AACrC,CAAC;AAFe,cAAM,SAErB,CAAA","sourcesContent":["\nimport { Observable, ObservableInput } from '../Observable';\nimport { catchError as higherOrder } from '../operators/catchError';\n\n/**\n * Catches errors on the observable to be handled by returning a new observable or throwing an error.\n *\n * <img src=\"./img/catch.png\" width=\"100%\">\n *\n * @example <caption>Continues with a different Observable when there's an error</caption>\n *\n * Observable.of(1, 2, 3, 4, 5)\n * .map(n => {\n * \t if (n == 4) {\n * \t throw 'four!';\n * }\n *\t return n;\n * })\n * .catch(err => Observable.of('I', 'II', 'III', 'IV', 'V'))\n * .subscribe(x => console.log(x));\n * // 1, 2, 3, I, II, III, IV, V\n *\n * @example <caption>Retries the caught source Observable again in case of error, similar to retry() operator</caption>\n *\n * Observable.of(1, 2, 3, 4, 5)\n * .map(n => {\n * \t if (n === 4) {\n * \t throw 'four!';\n * }\n * \t return n;\n * })\n * .catch((err, caught) => caught)\n * .take(30)\n * .subscribe(x => console.log(x));\n * // 1, 2, 3, 1, 2, 3, ...\n *\n * @example <caption>Throws a new error when the source Observable throws an error</caption>\n *\n * Observable.of(1, 2, 3, 4, 5)\n * .map(n => {\n * if (n == 4) {\n * throw 'four!';\n * }\n * return n;\n * })\n * .catch(err => {\n * throw 'error in source. Details: ' + err;\n * })\n * .subscribe(\n * x => console.log(x),\n * err => console.log(err)\n * );\n * // 1, 2, 3, error in source. Details: four!\n *\n * @param {function} selector a function that takes as arguments `err`, which is the error, and `caught`, which\n * is the source observable, in case you'd like to \"retry\" that observable by returning it again. Whatever observable\n * is returned by the `selector` will be used to continue the observable chain.\n * @return {Observable} An observable that originates from either the source or the observable returned by the\n * catch `selector` function.\n * @method catch\n * @name catch\n * @owner Observable\n */\nexport function _catch<T, R>(this: Observable<T>, selector: (err: any, caught: Observable<T>) => ObservableInput<R>): Observable<T | R> {\n return higherOrder(selector)(this);\n}\n"]}