Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

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