fix(api): fail fast on unexpected null document payload

This commit is contained in:
2026-10-10 16:12:56 +02:00
parent b6aec7a16b
commit 41d49e4b89
2 changed files with 5 additions and 7 deletions

View File

@@ -27,13 +27,7 @@ public sealed class DocumentsController(ISender sender) : ControllerBase
public async Task<IActionResult> GetAsync([FromRoute] string id, CancellationToken cancellationToken) public async Task<IActionResult> GetAsync([FromRoute] string id, CancellationToken cancellationToken)
{ {
var response = await sender.Send(new GetDocumentQuery(id), cancellationToken); var response = await sender.Send(new GetDocumentQuery(id), cancellationToken);
var data = response.Data; var data = response.Data ?? throw new InvalidOperationException("Document payload is unexpectedly null.");
if (data is null)
{
return NotFound(response);
}
return File(data.Content, data.ContentType, data.FileName); return File(data.Content, data.ContentType, data.FileName);
} }
} }

View File

@@ -8,6 +8,10 @@
"Swagger": { "Swagger": {
"EnabledInProduction": false "EnabledInProduction": false
}, },
"Database": {
"CommandTimeoutSeconds": 30,
"WorkflowListingObjectType": "Ferdinand"
},
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {
"Default": "Information", "Default": "Information",