Skip to content

Instantly share code, notes, and snippets.

@jayd3e
Created September 27, 2014 17:57
Show Gist options
  • Save jayd3e/4e12a3cb595ab2439011 to your computer and use it in GitHub Desktop.
Save jayd3e/4e12a3cb595ab2439011 to your computer and use it in GitHub Desktop.
@event.listens_for(Engine, "handle_error")
def handle_exception(context):
if isinstance(context.original_exception,
psycopg2.OperationalError) and \
"SSL disconnect" in str(context.original_exception):
context.is_disconnect=True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment