-
-
Notifications
You must be signed in to change notification settings - Fork 620
remove try catch #1310
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
remove try catch #1310
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,17 +20,9 @@ public GraphKnowledgeService( | |
|
|
||
| public async Task<GraphQueryResult> ExecuteQueryAsync(string query, GraphQueryOptions? options = null) | ||
| { | ||
| try | ||
| { | ||
| var db = GetGraphDb(options?.Provider); | ||
| var result = await db.ExecuteQueryAsync(query, options); | ||
| return result; | ||
| } | ||
| catch (Exception ex) | ||
| { | ||
| _logger.LogError(ex, $"Error when searching graph knowledge (Query: {query})."); | ||
| return new GraphQueryResult(); | ||
| } | ||
| var db = GetGraphDb(options?.Provider); | ||
| var result = await db.ExecuteQueryAsync(query, options); | ||
| return result; | ||
|
Comment on lines
+23
to
+25
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 3. Null graph db dereference GraphKnowledgeService.ExecuteQueryAsync can dereference a null IGraphDb when GetGraphDb returns null (no registered provider match), causing a NullReferenceException that now propagates to callers. This will break /knowledge/graph/search and any other callers because there is no controller- or middleware-level exception handling in production. Agent Prompt
|
||
| } | ||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,7 +55,7 @@ public async Task<GraphQueryResult> ExecuteQueryAsync(string query, GraphQueryEx | |
| { | ||
| var argLogs = args.Select(x => (new KeyValue(x.Key, x.Value.ConvertToString(BotSharpOptions.defaultJsonOptions))).ToString()); | ||
| _logger.LogError(ex, $"Error when executing query in {Provider} graph db. (Query: {query}), (Argments: \r\n{string.Join("\r\n", argLogs)})"); | ||
| return new(); | ||
| throw; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2. Rethrow breaks safe fallback The graph DB implementation now rethrows exceptions instead of returning a safe fallback result, increasing the likelihood of runtime failures propagating across the provider boundary. This violates the requirement for safe fallback behavior with clear logging at provider/storage boundaries. Agent Prompt
|
||
| } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1. Removed query error fallback
📘 Rule violation⛯ ReliabilityAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools