Move error handling to utils

This commit is contained in:
Jeremy Zhang 2018-02-19 07:48:57 +00:00
parent 2d81c923a9
commit 1d085d328b
2 changed files with 6 additions and 5 deletions

View File

@ -11,9 +11,6 @@ class Gateway(Namespace):
db.session.commit()
db.session.remove()
def on_error(self):
disconnect()
def on_connect(self):
emit('hello')

View File

@ -2,7 +2,7 @@ from titanembeds.database import db, Guilds, UnauthenticatedUsers, Unauthenticat
from titanembeds.constants import LANGUAGES
from flask import request, session
from flask_limiter import Limiter
from flask_socketio import SocketIO
from flask_socketio import SocketIO, disconnect
from flask_babel import Babel
from flask_redis import FlaskRedis
from config import config
@ -324,4 +324,8 @@ def language_code_list():
rate_limiter = Limiter(key_func=get_client_ipaddr) # Default limit by ip address
socketio = SocketIO()
babel = Babel()
babel = Babel()
@socketio.on_error_default # disconnect on all errors
def default_socketio_error_handler(e):
disconnect()