class Opal::Nodes::DefinedNode

def wrap_with_try_catch(code)

def wrap_with_try_catch(code)
  returning_tmp = scope.new_temp
  push "(#{returning_tmp} = (function() { try {"
  push "  return #{code};"
  push '} catch ($err) {'
  push '  if (Opal.rescue($err, [Opal.Exception])) {'
  push '    try {'
  push '      return false;'
  push '    } finally { Opal.pop_exception($err); }'
  push '  } else { throw $err; }'
  push '}})())'
  returning_tmp
end