Better error handling

This commit is contained in:
Michel Roux 2020-03-22 17:53:50 +01:00
parent 63d4a722f1
commit a2d691dbf9
2 changed files with 6 additions and 5 deletions

8
app.py
View File

@ -1,5 +1,6 @@
import time
from logging import getLogger
from operator import attrgetter, itemgetter
from time import sleep
from flask import redirect, render_template, request, url_for
@ -182,6 +183,7 @@ if __name__ == '__main__':
while True:
try:
app.run('0.0.0.0', APP_PORT, IS_DEBUG)
except Exception:
time.sleep(10)
except Exception as e:
getLogger().exception(e)
sleep(10)
pass

View File

@ -10,7 +10,6 @@ from urllib.parse import quote
import requests
from bs4 import BeautifulSoup
from requests import Timeout
from config import IS_DEBUG, CACHE_TIMEOUT, BLACKLIST_WORDS
from models import AnimeLink
@ -164,7 +163,7 @@ class Connector(ABC):
output = response.text
http_code = response.status_code
except Timeout as e:
except requests.Timeout as e:
output = ''
http_code = 500
if IS_DEBUG: