Unify error status code as RecStatus.Failed
Renamed RecStatus.QueryFailed to RecStatus.Failed and updated all usages and documentation to reflect its broader purpose as a general failure code for any operation, not just SQL queries. Improved consistency in error handling and status reporting across the codebase.
This commit is contained in:
@@ -36,7 +36,7 @@ public class PostprocessingBehavior(IRecDbContext context, ISender sender) : IPi
|
|||||||
|
|
||||||
await sender.Send(new InsertResultCommand()
|
await sender.Send(new InsertResultCommand()
|
||||||
{
|
{
|
||||||
Status = RecStatus.QueryFailed,
|
Status = RecStatus.Failed,
|
||||||
ActionId = request.Action.Id,
|
ActionId = request.Action.Id,
|
||||||
Error = error,
|
Error = error,
|
||||||
Type = ResultType.Post
|
Type = ResultType.Post
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class PreprocessingBehavior(IRecDbContext context, ISender sender) : IPip
|
|||||||
{
|
{
|
||||||
await sender.Send(new InsertResultCommand()
|
await sender.Send(new InsertResultCommand()
|
||||||
{
|
{
|
||||||
Status = RecStatus.QueryFailed,
|
Status = RecStatus.Failed,
|
||||||
ActionId = request.Action.Id,
|
ActionId = request.Action.Id,
|
||||||
Error = ex.ToString(),
|
Error = ex.ToString(),
|
||||||
Type = ResultType.Pre
|
Type = ResultType.Pre
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ public class InvokeRecActionViewCommandHandler(
|
|||||||
{
|
{
|
||||||
await sender.Send(new InsertResultCommand()
|
await sender.Send(new InsertResultCommand()
|
||||||
{
|
{
|
||||||
Status = RecStatus.QueryFailed,
|
Status = RecStatus.Failed,
|
||||||
ActionId = action.Id,
|
ActionId = action.Id,
|
||||||
Error = ex.ToString(),
|
Error = ex.ToString(),
|
||||||
Type = ResultType.Main
|
Type = ResultType.Main
|
||||||
|
|||||||
@@ -6,8 +6,7 @@ namespace ReC.Domain.Constants;
|
|||||||
/// Represents status codes used to indicate the outcome of an operation.
|
/// Represents status codes used to indicate the outcome of an operation.
|
||||||
/// <para>
|
/// <para>
|
||||||
/// Includes all standard HTTP status codes as defined in <see cref="System.Net.HttpStatusCode"/>,
|
/// Includes all standard HTTP status codes as defined in <see cref="System.Net.HttpStatusCode"/>,
|
||||||
/// as well as custom non-HTTP status codes for SQL query execution results
|
/// as well as custom non-HTTP status codes for internal operation results.
|
||||||
/// (e.g., <see cref="RecActionView.PreprocessingQuery"/> and <see cref="RecActionView.PostprocessingQuery"/>).
|
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <seealso cref="RecStatusExtensions"/>
|
/// <seealso cref="RecStatusExtensions"/>
|
||||||
@@ -21,11 +20,11 @@ public enum RecStatus : short
|
|||||||
QuerySuccess = 0,
|
QuerySuccess = 0,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Indicates that a SQL query execution failed (value 999).
|
/// Indicates that an operation failed at any stage (value 999).
|
||||||
/// Used as the result status when <see cref="RecActionView.PreprocessingQuery"/>
|
/// This includes SQL query failures during preprocessing/postprocessing,
|
||||||
/// or <see cref="RecActionView.PostprocessingQuery"/> throws an exception.
|
/// HTTP request errors, or any other unhandled exception within the action pipeline.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
QueryFailed = 999,
|
Failed = 999,
|
||||||
|
|
||||||
//
|
//
|
||||||
// Summary:
|
// Summary:
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public static class RecStatusExtensions
|
|||||||
=> status switch
|
=> status switch
|
||||||
{
|
{
|
||||||
RecStatus.QuerySuccess => true,
|
RecStatus.QuerySuccess => true,
|
||||||
RecStatus.QueryFailed => false,
|
RecStatus.Failed => false,
|
||||||
_ => status.ToHttpStatusCode() is HttpStatusCode httpStatus && httpStatus.IsSuccess()
|
_ => status.ToHttpStatusCode() is HttpStatusCode httpStatus && httpStatus.IsSuccess()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user