2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-01 03:00:54 +00:00

Log plugin event errors (#6455)

* Log plugin event errors

- Log errors from plugins running process_event function

* Catch exception on custom validation

* Catch some more errors

* Fix circular imports
This commit is contained in:
Oliver
2024-02-08 17:31:53 +11:00
committed by GitHub
parent af4d888b1b
commit 325841dbf1
4 changed files with 29 additions and 2 deletions

View File

@ -25,6 +25,7 @@ from mptt.models import MPTTModel, TreeForeignKey
from taggit.managers import TaggableManager
import common.models
import InvenTree.exceptions
import InvenTree.helpers
import InvenTree.models
import InvenTree.ready
@ -601,6 +602,10 @@ class StockItem(
plugin.validate_batch_code(self.batch, self)
except ValidationError as exc:
raise ValidationError({'batch': exc.message})
except Exception:
InvenTree.exceptions.log_error(
f'plugin.{plugin.slug}.validate_batch_code'
)
def clean(self):
"""Validate the StockItem object (separate to field validation).