Updated all 404 and 500 responses to use problem details model (#14634)

* Updated all 404 and 500 responses to use problem details

* Updated OpenApi.json

* Add missing ProducesResponseType

* Updated OpenApi.json
This commit is contained in:
Bjarke Berg
2023-08-04 10:51:20 +02:00
committed by GitHub
parent 7b78fe9ced
commit 45033437a2
111 changed files with 1773 additions and 309 deletions

View File

@@ -24,10 +24,16 @@ public abstract class TemporaryFileControllerBase : ManagementApiControllerBase
.WithDetail("The specified key is already used.")
.Build()),
TemporaryFileOperationStatus.NotFound => NotFound(),
_ => StatusCode(StatusCodes.Status500InternalServerError, "Unknown temporary file operation status")
TemporaryFileOperationStatus.NotFound => NotFound(new ProblemDetailsBuilder()
.WithTitle("The temporary file was not found")
.Build()),
_ => StatusCode(StatusCodes.Status500InternalServerError, new ProblemDetailsBuilder()
.WithTitle("Unknown temporary file operation status.")
.Build()),
};
protected new IActionResult NotFound() => NotFound("The temporary file could not be found");
protected IActionResult TemporaryFileNotFound() => NotFound(new ProblemDetailsBuilder()
.WithTitle("The temporary file could not be found")
.Build());
}