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:
@@ -31,7 +31,7 @@ public class ByPathStylesheetController : StylesheetControllerBase
|
||||
|
||||
if (stylesheet is null)
|
||||
{
|
||||
return NotFound();
|
||||
return StylesheetNotFound();
|
||||
}
|
||||
|
||||
StylesheetResponseModel? viewModel = _umbracoMapper.Map<StylesheetResponseModel>(stylesheet);
|
||||
|
||||
@@ -59,6 +59,8 @@ public class StylesheetFolderControllerBase : PathFolderManagementControllerBase
|
||||
.WithTitle("Invalid name")
|
||||
.WithDetail("The name specified is not a valid name.")
|
||||
.Build()),
|
||||
_ => StatusCode(StatusCodes.Status500InternalServerError, "Unknown stylesheet folder operation status")
|
||||
_ => StatusCode(StatusCodes.Status500InternalServerError, new ProblemDetailsBuilder()
|
||||
.WithTitle("Unknown stylesheet folder operation status.")
|
||||
.Build()),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user