Skip to content

Commit

Permalink
feat: added logs to errors imports (#259)
Browse files Browse the repository at this point in the history
* feat: added logs to errors in imports

* fix: log.error in ImportError

* feat: refactor old commits
  • Loading branch information
BetoFandino authored May 17, 2024
1 parent 92bd3d9 commit 50cb82e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 4 additions & 2 deletions eox_core/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,21 @@
from eox_core.models import Redirection
from eox_core.utils import cache, fasthash

LOG = logging.getLogger(__name__)

try:
from eox_tenant.pipeline import EoxTenantAuthException
except ImportError:

class EoxTenantAuthException:
"""Dummy eox-tenant Exception."""

LOG.warning("ImportError while importing %s", EoxTenantAuthException)


configuration_helper = get_configuration_helper() # pylint: disable=invalid-name
ExceptionMiddleware = get_tpa_exception_middleware()

LOG = logging.getLogger(__name__)


class PathRedirectionMiddleware(MiddlewareMixin):
"""
Expand Down
5 changes: 5 additions & 0 deletions eox_core/settings/production.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
"""
Settings for eox_core project meant to be called on the edx-platform/*/envs/aws.py module
"""
import logging

from .common import * # pylint: disable=wildcard-import, unused-wildcard-import

LOG = logging.getLogger(__name__)

try:
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
except ImportError:
sentry_sdk = DjangoIntegration = None
LOG.error("ImportError while importing %s", ImportError)


def plugin_settings(settings): # pylint: disable=function-redefined
Expand Down

0 comments on commit 50cb82e

Please sign in to comment.