Skip to content

Commit

Permalink
fix(utils): raise exception on failing creation of object
Browse files Browse the repository at this point in the history
  • Loading branch information
b1rger committed Nov 18, 2024
1 parent d657a98 commit d93a17d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion apis_core/utils/helpers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import difflib

from django.apps import apps
from django.contrib.contenttypes.models import ContentType
from django.core import serializers
from django.core.exceptions import ImproperlyConfigured
from django.db import DEFAULT_DB_ALIAS, router
Expand Down Expand Up @@ -81,7 +82,10 @@ def create_object_from_uri(uri: str, model: object) -> object:
instance = importer.create_instance()
uri = Uri.objects.create(uri=importer.get_uri, root_object=instance)
return instance
return None
content_type = ContentType.objects.get_for_model(model)
raise ImproperlyConfigured(
f'Could not create {content_type.name} from string "{uri}"'
)


def get_html_diff(a, b, show_a=True, show_b=True, shorten=0):
Expand Down

0 comments on commit d93a17d

Please sign in to comment.