From 8ca02cb105ff7be33993e119e1e819577b2dc9f2 Mon Sep 17 00:00:00 2001 From: Oliver Date: Mon, 12 Jun 2023 21:03:08 +1000 Subject: [PATCH] Catch exception (#5008) * Catch exception * Update settings.py Don't print out exception message, just log error * Update settings.py Style fixes * Update settings.py Remove error message * Update settings.py Remove logger --- InvenTree/common/settings.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/InvenTree/common/settings.py b/InvenTree/common/settings.py index be049cf433..0c84e51ee7 100644 --- a/InvenTree/common/settings.py +++ b/InvenTree/common/settings.py @@ -7,14 +7,13 @@ from moneyed import CURRENCIES def currency_code_default(): """Returns the default currency code (or USD if not specified)""" - from django.db.utils import ProgrammingError from common.models import InvenTreeSetting try: code = InvenTreeSetting.get_setting('INVENTREE_DEFAULT_CURRENCY', create=False, cache=False) - except ProgrammingError: # pragma: no cover - # database is not initialized yet + except Exception: # pragma: no cover + # Database may not yet be ready, no need to throw an error here code = '' if code not in CURRENCIES: @@ -42,4 +41,4 @@ def stock_expiry_enabled(): """Returns True if the stock expiry feature is enabled.""" from common.models import InvenTreeSetting - return InvenTreeSetting.get_setting('STOCK_ENABLE_EXPIRY') + return InvenTreeSetting.get_setting('STOCK_ENABLE_EXPIRY', False, create=False)