2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-29 03:56:43 +00:00

Handle ValidationError when creating a new setting (#4868)

- Duplicate keys can occur in some race conditions
- Catch and pass ValidationError
This commit is contained in:
Oliver 2023-05-22 12:12:02 +10:00 committed by GitHub
parent 63da2ae9f7
commit 5992dcdfda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -453,6 +453,9 @@ class BaseInvenTreeSetting(models.Model):
except (IntegrityError, OperationalError): except (IntegrityError, OperationalError):
# It might be the case that the database isn't created yet # It might be the case that the database isn't created yet
pass pass
except ValidationError:
# The setting failed validation - might be due to duplicate keys
pass
if setting and do_cache: if setting and do_cache:
# Cache this setting object # Cache this setting object