try-catch.ts

12 lines | 384 B Blame History Raw Download
import { NotificationBubbles } from "../../codeeditor-app/elements/notification-bubbles/notification-bubbles";

export function tryCatch(fn: Function) {
    try {
        fn();
    }
    catch (err) {
        var bubbles = <NotificationBubbles>parent.document.body.getElementsByTagName("notification-bubbles")[0];
        //@ts-ignore
        bubbles.add(err, 'syntax-error');
    }
}