File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed
Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change 33from django .conf import settings
44from django .test .signals import setting_changed
55
6+ DEFAULTS = {
7+ 'EXT_SHOW_ERROR_MESSAGE_HANDLER' :
8+ 'graphql_extensions.views.show_error_message' ,
9+ }
10+
11+ IMPORT_STRINGS = (
12+ 'EXT_SHOW_ERROR_MESSAGE_HANDLER' ,
13+ )
14+
15+
616def perform_import (value , setting_name ):
717 if value is not None and isinstance (value , str ):
818 return import_from_string (value , setting_name )
Original file line number Diff line number Diff line change 1111from graphql .error .located_error import GraphQLLocatedError
1212
1313from . import exceptions
14+ from .settings import extensions_settings
15+
16+
17+ def show_error_message (error ):
18+ return settings .DEBUG or isinstance (error , (
19+ exceptions .GraphQLError ,
20+ GraphQLError ,
21+ ))
1422
1523
1624class GraphQLView (BaseGraphQLView ):
@@ -23,10 +31,7 @@ def format_error(error):
2331 formatted_error = format_graphql_error (error )
2432 graphql_error = OrderedDict ([('type' , error .__class__ .__name__ )])
2533
26- if settings .DEBUG or isinstance (error , (
27- exceptions .GraphQLError ,
28- GraphQLError ,
29- )):
34+ if extensions_settings .EXT_SHOW_ERROR_MESSAGE_HANDLER (error ):
3035 graphql_error ['message' ] = formatted_error ['message' ]
3136 else :
3237 # Internal errors must be masked
You can’t perform that action at this time.
0 commit comments