move in wrapInTryCatch from extendFunction.js