diff --git a/src/openforms/contrib/brk/service.py b/src/openforms/contrib/brk/service.py index 2d1d49056f..4f0f2557fc 100644 --- a/src/openforms/contrib/brk/service.py +++ b/src/openforms/contrib/brk/service.py @@ -1,4 +1,4 @@ -from openforms.forms.models.form import Form +from openforms.forms.models import Form from openforms.plugins.exceptions import InvalidPluginConfiguration from .checks import BRKValidatorCheck @@ -10,7 +10,7 @@ def check_brk_config_for_addressNL() -> str: if any(form.has_component("addressNL") for form in live_forms): try: BRKValidatorCheck.check_config() - except InvalidPluginConfiguration as e: - return e.args[0] + except InvalidPluginConfiguration as exc: + return exc.message return "" diff --git a/src/openforms/contrib/kadaster/service.py b/src/openforms/contrib/kadaster/service.py index 4fbd5489ab..3becf8512e 100644 --- a/src/openforms/contrib/kadaster/service.py +++ b/src/openforms/contrib/kadaster/service.py @@ -1,5 +1,5 @@ from openforms.contrib.kadaster.config_check import BAGCheck -from openforms.forms.models.form import Form +from openforms.forms.models import Form from openforms.plugins.exceptions import InvalidPluginConfiguration @@ -20,7 +20,7 @@ def check_bag_config_for_address_fields() -> str: try: BAGCheck.check_config() - except InvalidPluginConfiguration as e: - return e.args[0] + except InvalidPluginConfiguration as exc: + return exc.message return "" diff --git a/src/openforms/plugins/exceptions.py b/src/openforms/plugins/exceptions.py index d00f43a8db..29cdd709c4 100644 --- a/src/openforms/plugins/exceptions.py +++ b/src/openforms/plugins/exceptions.py @@ -1,5 +1,7 @@ class InvalidPluginConfiguration(Exception): - pass + def __init__(self, message: str, *args, **kwargs): + self.message = message + super().__init__(message, *args, **kwargs) class PluginNotEnabled(Exception):