Skip to content

Instantly share code, notes, and snippets.

@thurloat
Created August 12, 2010 19:42
Show Gist options
  • Save thurloat/521587 to your computer and use it in GitHub Desktop.
Save thurloat/521587 to your computer and use it in GitHub Desktop.
class ResponseObject():
html = None
def __init__(self, html):
self.html = html
def render(self):
print "<html>"
print self.html
print "</html>"
def get_user_information():
raise ResponseObject("<p>Logged In User Is Steve</p>")
def main():
response = ResponseObject("<h1>Exception Pattern</h1>")
try:
get_user_information()
except ResponseObject, e:
response.html += e.html
raise response
try:
main()
except ResponseObject, res:
print res.render()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment