Handle inability to establish connection

This commit is contained in:
Collin R
2020-02-09 22:20:29 -08:00
parent 582c2c5a39
commit 582aebaf0f

View File

@@ -1,6 +1,7 @@
import re import re
import praw import praw
import prawcore
from . import config, database, level, reply from . import config, database, level, reply
@@ -40,6 +41,8 @@ def run():
monitor_comments(subreddit, db) monitor_comments(subreddit, db)
# Ignoring other potential exceptions for now, since we may not be able # Ignoring other potential exceptions for now, since we may not be able
# to recover from them as well as from this one # to recover from them as well as from this one
except prawcore.exceptions.RequestException as e:
print('Unable to connect; attempting again....')
except prawcore.exceptions.ServerError as e: except prawcore.exceptions.ServerError as e:
print('Lost connection to Reddit; attempting to reconnect....') print('Lost connection to Reddit; attempting to reconnect....')