Skip to content

Commit e09157f

Browse files
authored
Fix some exception handling bugs (#759)
1 parent 47c2987 commit e09157f

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/Transports.AspNetCore/GraphQLHttpMiddleware.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ public virtual async Task InvokeAsync(HttpContext context, RequestDelegate next)
129129
{
130130
if (!await HandleDeserializationErrorAsync(context, ex))
131131
throw;
132+
return;
132133
}
133134
break;
134135
}
@@ -142,7 +143,17 @@ public virtual async Task InvokeAsync(HttpContext context, RequestDelegate next)
142143
GraphQLRequest gqlRequest = null;
143144
if (bodyGQLBatchRequest == null)
144145
{
145-
var urlGQLRequest = DeserializeFromQueryString(httpRequest.Query);
146+
GraphQLRequest urlGQLRequest = null;
147+
try
148+
{
149+
urlGQLRequest = DeserializeFromQueryString(httpRequest.Query);
150+
}
151+
catch (Exception ex)
152+
{
153+
if (!await HandleDeserializationErrorAsync(context, ex))
154+
throw;
155+
return;
156+
}
146157

147158
gqlRequest = new GraphQLRequest
148159
{

0 commit comments

Comments
 (0)