@@ -1,3 +1,5 @@ +import logging + from django.conf import settings from django.conf.urls.static import static from django.contrib import admin @@ -16,9 +18,12 @@ api.add_router('users/', 'authentication.routes.v1.router') api.add_router('chats/', 'tools.chats.routes.v1.router') api.add_router('media/', 'tools.media.routes.v1.router') +logger = logging.getLogger(__name__) + @api.exception_handler(ObjectDoesNotExist) def object_does_not_exists_error_handler(request, exc: ObjectDoesNotExist): + logger.exception(exc) return api.create_response( request, {'message': _('Requested object does not exists')}, status=404 ) @@ -26,16 +31,19 @@ def object_does_not_exists_error_handler(request, exc: ObjectDoesNotExist): @api.exception_handler(InvalidToken) def invalid_token_error_handler(request, exc: InvalidToken): + logger.exception(exc) return api.create_response(request, {'message': _('Token is invalid')}, status=401) @api.exception_handler(InvalidPassword) def invalid_password_error_handler(request, exc: InvalidPassword): + logger.exception(exc) return api.create_response(request, {'message': _('Wrong password')}, status=401) @api.exception_handler(InvalidUsername) def invalid_username_error_handler(request, exc: InvalidUsername): + logger.exception(exc) return api.create_response(request, {'message': _('Wrong username')}, status=401) @@ -81,7 +81,8 @@ services: networks: default: - name: "air" + name: infrastructure + external: true volumes: static: