mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 21:15:41 +00:00
Exception handling (#5622)
* get_setting_object: Handle ProgrammingError * Improved exception handling - Address a few cases on application startup if the database is not ready (migrations not applied)
This commit is contained in:
@ -182,8 +182,11 @@ class LabelConfig(AppConfig):
|
||||
shutil.copyfile(src_file, dst_file)
|
||||
|
||||
# Check if a label matching the template already exists
|
||||
if model.objects.filter(label=filename).exists():
|
||||
return # pragma: no cover
|
||||
try:
|
||||
if model.objects.filter(label=filename).exists():
|
||||
return # pragma: no cover
|
||||
except Exception:
|
||||
logger.error(f"Failed to query label for '{filename}' - you should run 'invoke update' first!")
|
||||
|
||||
logger.info(f"Creating entry for {model} '{label['name']}'")
|
||||
|
||||
|
Reference in New Issue
Block a user