mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-07-13 17:52:19 +03:00
improve error handling
This commit is contained in:
parent
f76f38ef30
commit
a8a2f00ab0
|
@ -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)
|
||||
|
||||
|
||||
|
@ -130,4 +138,4 @@ def reload_graphene_settings(*args, **kwargs):
|
|||
graphene_settings = GrapheneSettings(value, DEFAULTS, IMPORT_STRINGS)
|
||||
|
||||
|
||||
setting_changed.connect(reload_graphene_settings)
|
||||
setting_changed.connect(reload_graphene_settings)
|
Loading…
Reference in New Issue
Block a user