def alt(mayThrow, altValue):
  """Combines an expression with a fallback to use if the first expression
  failes with an exception."""

  return '(function(){try{return(%s);}catch(e){return(%s);}})()' % (
      mayThrow, altValue)