Show connector error only on debug mode

This commit is contained in:
Michel Roux 2019-12-13 10:43:01 +01:00
parent fea6339cb8
commit 558e8170da
2 changed files with 4 additions and 2 deletions

2
app.py
View File

@ -2,7 +2,7 @@ from operator import itemgetter
from flask import redirect, render_template, request, url_for from flask import redirect, render_template, request, url_for
from config import app, auth, db, ADMIN_USERNAME, ADMIN_PASSWORD, APP_PORT, IS_DEBUG from config import app, auth, db, ADMIN_USERNAME, ADMIN_PASSWORD, APP_PORT
from connectors import * from connectors import *
from models import AnimeFolder, AnimeTitle, DeleteForm, SearchForm, EditForm from models import AnimeFolder, AnimeTitle, DeleteForm, SearchForm, EditForm

View File

@ -10,6 +10,7 @@ from sys import platform
import requests import requests
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from config import IS_DEBUG
from models import AnimeLink from models import AnimeLink
@ -137,7 +138,8 @@ class Connector(ABC):
except Exception as e: except Exception as e:
output = '' output = ''
http_code = 500 http_code = 500
print(e) if IS_DEBUG:
print(e)
else: else:
if ajax: if ajax:
headers = {'X-Requested-With': 'XMLHttpRequest'} headers = {'X-Requested-With': 'XMLHttpRequest'}