diff --git a/backend/src/Squidex.Infrastructure/Dump/Dumper.cs b/backend/src/Squidex.Infrastructure/Dump/Dumper.cs index 2a4de2bec..c9cc7c9e6 100644 --- a/backend/src/Squidex.Infrastructure/Dump/Dumper.cs +++ b/backend/src/Squidex.Infrastructure/Dump/Dumper.cs @@ -124,11 +124,9 @@ namespace Squidex.Infrastructure.Dump await process.WaitForExitAsync(ctl.Token); - var isSucceess = process.ExitCode == 0; - - if (!isSucceess) + if (process.ExitCode != 0) { - return false; + throw new InvalidOperationException($"Failed to execute tool. Got exit code: {process.ExitCode}."); } await using (var fs = new FileStream(writtenFile, FileMode.Open)) diff --git a/backend/src/Squidex/Areas/Api/Controllers/Diagnostics/DiagnosticsController.cs b/backend/src/Squidex/Areas/Api/Controllers/Diagnostics/DiagnosticsController.cs index bb3a7e59e..0c511569d 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Diagnostics/DiagnosticsController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Diagnostics/DiagnosticsController.cs @@ -32,13 +32,19 @@ namespace Squidex.Areas.Api.Controllers.Diagnostics /// /// /// 204 => Dump created successful. + /// 501 => Not configured. /// [HttpGet] [Route("diagnostics/dump")] [ApiPermissionOrAnonymous(Permissions.Admin)] public async Task GetDump() { - await dumper.CreateDumpAsync(HttpContext.RequestAborted); + var success = await dumper.CreateDumpAsync(HttpContext.RequestAborted); + + if (!success) + { + return StatusCode(501); + } return NoContent(); } @@ -48,13 +54,19 @@ namespace Squidex.Areas.Api.Controllers.Diagnostics /// /// /// 204 => Dump created successful. + /// 501 => Not configured. /// [HttpGet] [Route("diagnostics/gc-dump")] [ApiPermissionOrAnonymous(Permissions.Admin)] public async Task GetGCDump() { - await dumper.CreateGCDumpAsync(HttpContext.RequestAborted); + var success = await dumper.CreateGCDumpAsync(HttpContext.RequestAborted); + + if (!success) + { + return StatusCode(501); + } return NoContent(); }