improve error handling

This commit is contained in:
Sebastian Weiss 2018-12-29 22:53:17 +01:00
parent f76f38ef30
commit a8a2f00ab0

View File

@ -75,6 +75,14 @@ def import_from_string(val, setting_name):
e.__class__.__name__,
e,
)
if "has no attribute 'name'" in str(e):
object_name = str(e).split("'")[1]
msg = "Could not import '%s' for Graphene setting '%s'. %s: %s must inherit from DjangoObjectType." % (
val,
setting_name,
e.__class__.__name__,
object_name,
)
raise ImportError(msg)