Code coverage report for src/util/tryCatch.ts

Statements: 100% (11 / 11)      Branches: 100% (0 / 0)      Functions: 100% (2 / 2)      Lines: 100% (10 / 10)      Ignored: none     

All files » src/util/ » tryCatch.ts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 181   1   1 23448 23448   122 122       1 23448 23448    
import {errorObject} from './errorObject';
 
let tryCatchTarget: Function;
 
function tryCatcher(): any {
  try {
    return tryCatchTarget.apply(this, arguments);
  } catch (e) {
    errorObject.e = e;
    return errorObject;
  }
}
 
export function tryCatch<T extends Function>(fn: T): T {
  tryCatchTarget = fn;
  return <any>tryCatcher;
};