mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
reafactor
This commit is contained in:
parent
9bb6bb294c
commit
9b02e3bdb7
@ -9,20 +9,6 @@ from django.conf import settings
|
||||
|
||||
|
||||
# region logging / errors
|
||||
def log_error(error, reference: str = 'general'):
|
||||
"""
|
||||
Log an plugin error
|
||||
"""
|
||||
from plugin import registry
|
||||
|
||||
# make sure the registry is set up
|
||||
if reference not in registry.errors:
|
||||
registry.errors[reference] = []
|
||||
|
||||
# add error to stack
|
||||
registry.errors[reference].append(error)
|
||||
|
||||
|
||||
class IntegrationPluginError(Exception):
|
||||
"""
|
||||
Error that encapsulates another error and adds the path / reference of the raising plugin
|
||||
@ -50,6 +36,20 @@ class MixinNotImplementedError(NotImplementedError):
|
||||
pass
|
||||
|
||||
|
||||
def log_error(error, reference: str = 'general'):
|
||||
"""
|
||||
Log an plugin error
|
||||
"""
|
||||
from plugin import registry
|
||||
|
||||
# make sure the registry is set up
|
||||
if reference not in registry.errors:
|
||||
registry.errors[reference] = []
|
||||
|
||||
# add error to stack
|
||||
registry.errors[reference].append(error)
|
||||
|
||||
|
||||
def handle_error(error, do_raise: bool = True, do_log: bool = True, do_return: bool = False, log_name: str = ''):
|
||||
"""
|
||||
Handles an error and casts it as an IntegrationPluginError
|
||||
|
Loading…
Reference in New Issue
Block a user