Update result handling and error status in command handler
Removed unused statusCode variable and now store HTTP status code as a string in the Info field. Changed exception handling to set Status to RecStatus.Error instead of RecStatus.Failed.
This commit is contained in:
@@ -142,14 +142,13 @@ public class InvokeRecActionViewCommandHandler(
|
||||
var resBody = await response.Content.ReadAsStringAsync(cancel);
|
||||
var resHeaders = response.Headers.ToDictionary();
|
||||
|
||||
var statusCode = (short)response.StatusCode;
|
||||
|
||||
await sender.Send(new InsertResultCommand()
|
||||
{
|
||||
Status = response.StatusCode.ToRecStatus(),
|
||||
ActionId = action.Id,
|
||||
Header = JsonSerializer.Serialize(resHeaders, options: new() { WriteIndented = false }),
|
||||
Body = resBody,
|
||||
Info = ((int)response.StatusCode).ToString(),
|
||||
Type = ResultType.Main
|
||||
}, cancel);
|
||||
}
|
||||
@@ -157,7 +156,7 @@ public class InvokeRecActionViewCommandHandler(
|
||||
{
|
||||
await sender.Send(new InsertResultCommand()
|
||||
{
|
||||
Status = RecStatus.Failed,
|
||||
Status = RecStatus.Error,
|
||||
ActionId = action.Id,
|
||||
Error = ex.ToString(),
|
||||
Type = ResultType.Main
|
||||
|
||||
Reference in New Issue
Block a user