Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log GremlinQueryExecutionException #1751

Merged
merged 2 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ trim_trailing_whitespace = true
[*.{cs,csx,vb,vbx}]
indent_size = 4
insert_final_newline = true
charset = utf-8-bom

charset = utf-8-bom
# Xml project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2
Expand Down Expand Up @@ -184,6 +184,7 @@ csharp_prefer_braces = false:none
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = false
csharp_indent_switch_labels = true
csharp_indent_labels = flush_left

Expand Down
15 changes: 14 additions & 1 deletion src/Providers.Core/Factory/GremlinqClientFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
using Gremlin.Net.Driver.Exceptions;
using Gremlin.Net.Driver.Messages;

using Microsoft.Extensions.Logging;

using static Gremlin.Net.Driver.Messages.ResponseStatusCode;

namespace ExRam.Gremlinq.Providers.Core
Expand Down Expand Up @@ -219,7 +221,18 @@ static async IAsyncEnumerable<T> Core(GremlinQueryExecutorImpl @this, GremlinQue
switch (response)
{
case { Status: { Code: var code and not Success and not NoContent and not PartialContent and not Authenticate } status }:
throw new GremlinQueryExecutionException(context, new ResponseException(code, status.Attributes, $"{status.Code}: {status.Message}"));
{
try
{
throw new GremlinQueryExecutionException(context, new ResponseException(code, status.Attributes, $"{status.Code}: {status.Message}"));
}
catch (GremlinQueryExecutionException ex)
{
environment.Logger.LogError(ex, "Execution of Gremlin query {requestId} succeeded but returned response status code {statusCode}.", requestMessage.RequestId, code);

throw;
}
}
case { Result.Data: { } data }:
{
foreach (var obj in data)
Expand Down