Skip to content

Instantly share code, notes, and snippets.

@basuke
Created October 26, 2010 03:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save basuke/646279 to your computer and use it in GitHub Desktop.
Save basuke/646279 to your computer and use it in GitHub Desktop.
def user_error_handler(func):
def wrapped(*args, **kwargs):
try:
response = func(*args, **kwargs)
except (InvalidUser,), e:
logger.error('%s: %s' % (func.__name__, str(e),))
response = HttpResponseNotFound('Not found')
return response
return wrapped
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment