function wrapTryCatch(node) { return babelTypes.tryStatement( babelTypes.blockStatement([node]), babelTypes.catchClause( babelTypes.identifier('e'), babelTypes.blockStatement([]))); }
/** * Create statements for extra printing at the end of a section. We print * the number of caught exceptions, a generic hash of all observed values * and the contents of all variables in scope. */ getSectionFooter(path) { const variables = common.availableVariables(path); const statements = variables.map(prettyPrintStatement); statements.unshift(printCaught()); statements.unshift(printHash()); const statement = babelTypes.tryStatement( babelTypes.blockStatement(statements), babelTypes.catchClause( babelTypes.identifier('e'), babelTypes.blockStatement([]))); this.annotate(statement, 'Print variables and exceptions from section'); return statement; }