UNPKG

@putout/engine-runner

Version:
15 lines (10 loc) 274 B
'use strict'; const tryCatch = require('try-catch'); module.exports.tryThrowWithReason = (fn, ...args) => { const [error, result] = tryCatch(fn, ...args); if (error) { error.reason ??= 'traverse'; throw error; } return result; };