source: trip-planner-front/node_modules/rxjs/src/internal/util/tryCatch.ts@ 8d391a1

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

initial commit

  • Property mode set to 100644
File size: 426 bytes
Line 
1import { errorObject } from './errorObject';
2
3let tryCatchTarget: Function;
4
5function tryCatcher(this: any): any {
6 errorObject.e = undefined;
7 try {
8 return tryCatchTarget.apply(this, arguments);
9 } catch (e) {
10 errorObject.e = e;
11 return errorObject;
12 } finally {
13 tryCatchTarget = undefined;
14 }
15}
16
17export function tryCatch<T extends Function>(fn: T): T {
18 tryCatchTarget = fn;
19 return <any>tryCatcher;
20}
Note: See TracBrowser for help on using the repository browser.