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

@@ -39,14 +39,18 @@ public class StylesheetControllerBase : ManagementApiControllerBase
.WithTitle("Path too long")
.WithDetail("The file path is too long.")
.Build()),
StylesheetOperationStatus.NotFound => NotFound(new ProblemDetailsBuilder()
.WithTitle("Stylesheet not found")
.WithDetail("The stylesheet was not found.")
.Build()),
StylesheetOperationStatus.NotFound => StylesheetNotFound(),
StylesheetOperationStatus.InvalidName => BadRequest(new ProblemDetailsBuilder()
.WithTitle("Invalid name")
.WithDetail("The stylesheet name is invalid.")
.Build()),
_ => StatusCode(StatusCodes.Status500InternalServerError, "Unknown script operation status"),
_ => StatusCode(StatusCodes.Status500InternalServerError, new ProblemDetailsBuilder()
.WithTitle("Unknown stylesheet operation status.")
.Build()),
};
protected IActionResult StylesheetNotFound() => NotFound(new ProblemDetailsBuilder()
.WithTitle("Stylesheet not found")
.WithDetail("The stylesheet was not found.")
.Build());
}