Skip to content

Commit

Permalink
Fixed few bugs in exception handling and file command/query
Browse files Browse the repository at this point in the history
  • Loading branch information
AlenGeoAlex committed Oct 13, 2024
1 parent 774234d commit ad82b2a
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public async Task<IEnumerable<Uri>> DeleteMultipleAsync(IEnumerable<Uri> uris)
}

var deletionResponse = await s3Client.DeleteObjectsAsync(deleteObjectsRequest);
logger.Information("The deletion request has been completed and has charged {Value}",deletionResponse.RequestCharged.Value);
logger.Information("The deletion request has been completed and has charged {Value}",deletionResponse.RequestCharged?.Value);

deletionResponse.DeleteErrors.ForEach(x =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public class FileRepository([FromKeyedServices("read-only-connection")]NpgsqlCon
MimeType = x.mime_type,
CreatedAt = x.created_at,
TargetUrl = x.target_url,
Favourite = x.favourite
Favourite = x.favourite,
ParentId = x.parent
};
}).FirstOrDefault();

Expand Down
2 changes: 1 addition & 1 deletion MyServe.Backend.Http.Api/Controllers/FilesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public async Task<ActionResult<CreateFileResponse>> CreateFile([FromBody] Create

if (fileResponse.File is not null)
{
return CreatedAtAction(nameof(GetFiles), fileResponse, new { id = fileResponse.File.Id });
return CreatedAtAction(nameof(GetFiles), fileResponse, fileResponse);
}

if (fileResponse.Message is not null && fileResponse.Message == CreateFileResponse.Duplicate)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private async Task HandleExceptionAsync(HttpContext context, Exception? exceptio
if (exceptionDetail.StatusCode is < 500 and >= 300 )
{
context.Response.Headers["MySe-Code"] = exceptionDetail.ErrorCode.ToString();
context.Response.Headers["MySe-Message"] = exceptionDetail.Message;
//context.Response.Headers["MySe-Message"] = exceptionDetail.Message;
}

if (exceptionDetail is { StatusCode: 401, Type: "Access Token Validation" })
Expand Down
2 changes: 1 addition & 1 deletion MyServe.Backend.Http.Api/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
}
},
"Origins": [
"http://localhost:4200/"
"http://localhost:4200"
],
"Serilog": {
"Using": ["Serilog.Sinks.Console", "Serilog.Sinks.File"],
Expand Down

0 comments on commit ad82b2a

Please sign in to comment.