Commit 1e9b464
committed
The most significant changes include the renaming of a method to reflect its asynchronous nature, the addition of a try-catch block to handle exceptions during query execution, and the implementation of a new strategy to handle
1. The method `FirstOrDefault` has been renamed to `FirstOrDefaultAsync`, indicating that the method is now asynchronous. This change is important as it provides clarity about the method's behavior and usage.
2. A try-catch block has been added around the query execution code. This change is crucial as it allows the program to handle exceptions that may occur during the execution of the query, preventing the program from crashing and providing a way to manage errors.
3. In case of an `InvalidOperationException`, the code now tries to retrieve the results again using a `CommandBehavior` of `CloseConnection`. This change suggests that the original exception might be due to connection issues, and closing the connection after retrieving the results might solve the problem.
4. If any other type of exception is thrown, it is simply re-thrown. This change allows the exception to be handled further up the call stack, providing a way to manage unexpected errors.
References to the code changes can be found at the end of each description.InvalidOperationException by attempting to retrieve results again with a CloseConnection command behavior.1 parent f6c93ab commit 1e9b464
File tree
1 file changed
+19
-4
lines changed- src/XperienceCommunity.AspNetCore.HealthChecks/Extensions
1 file changed
+19
-4
lines changedLines changed: 19 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
65 | 67 | | |
66 | | - | |
67 | | - | |
| 68 | + | |
| 69 | + | |
68 | 70 | | |
69 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
70 | 85 | | |
71 | 86 | | |
72 | 87 | | |
| |||
0 commit comments