fix exception logging

This commit is contained in:
Matthias Mair 2026-06-21 23:46:28 +02:00
parent 276102543f
commit 4973af2b07
No known key found for this signature in database
GPG Key ID: A593429DDA23B66A
1 changed files with 5 additions and 0 deletions

View File

@ -25,6 +25,7 @@ def log_error(
error_data: Optional[str] = None,
scope: Optional[str] = None,
plugin: Optional[str] = None,
user_id: Optional[int] = None,
):
"""Log an error to the database.
@ -37,6 +38,7 @@ def log_error(
error_data: The error data (optional, overrides 'data')
scope: The scope of the error (optional)
plugin: The plugin name associated with this error (optional)
user_id: The user ID associated with this error (optional)
"""
import InvenTree.ready
@ -71,6 +73,9 @@ def log_error(
except AttributeError:
data = 'No traceback information available'
if user_id:
data = f'User ID: {user_id}\n{data}'
# Log error to stderr
logger.error(info)