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