no log: deal with potential exception with missing time zone info.

This commit is contained in:
morpheus65535 2022-06-14 09:01:19 -04:00
parent 27f4c41a0e
commit 4640badd4b
1 changed files with 8 additions and 1 deletions

View File

@ -2,6 +2,7 @@
import os
import platform
import logging
from flask import jsonify
from flask_restful import Resource
@ -24,6 +25,12 @@ class SystemStatus(Resource):
if 'BAZARR_PACKAGE_AUTHOR' in os.environ and os.environ['BAZARR_PACKAGE_AUTHOR'] != '':
package_version = f'{package_version} by {os.environ["BAZARR_PACKAGE_AUTHOR"]}'
try:
timezone = get_localzone_name() or "Undefined"
except Exception:
timezone = "Exception while getting time zone name."
logging.exception("BAZARR is unable to get configured time zone name.")
system_status = {}
system_status.update({'bazarr_version': os.environ["BAZARR_VERSION"]})
system_status.update({'package_version': package_version})
@ -35,6 +42,6 @@ class SystemStatus(Resource):
os.path.dirname(__file__))))})
system_status.update({'bazarr_config_directory': args.config_dir})
system_status.update({'start_time': startTime})
system_status.update({'timezone': get_localzone_name() or 'Undefined'})
system_status.update({'timezone': timezone})
return jsonify(data=system_status)