-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
DoneThis issue has been fixedThis issue has been fixedarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing one
Milestone
Description
Add a set of new Problem helper methods on ControllerBase, that populates a ProblemDetails type with relevant values for simple returning of errors through the MVC response pipeline, e.g.:
private ObjectResult Problem()
{
return Problem(detail: null);
}
private ObjectResult Problem(string detail)
{
var problemDetails = new ProblemDetails
{
Title = "An error occurred while processing your request.",
Detail = detail,
Status = 500
};
problemDetails.Extensions.Add("traceId", Activity.Current?.Id ?? HttpContext.TraceIdentifier);
return Problem(problemDetails);
}
private ObjectResult Problem(ProblemDetails problemDetails)
{
return new ObjectResult(problemDetails) { StatusCode = problemDetails.Status };
}pranavkm, cremor, thomaslevesque and neman
Metadata
Metadata
Assignees
Labels
DoneThis issue has been fixedThis issue has been fixedarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing one