protected BadRequestObjectResult BadRequest()
{
return this.BadRequest("invalid input data");
}
protected (return type?) InternalServerError()
{
return ? // (what do I have to return here?);
}
What is the return type and what do I have to return?
CodePudding user response:
Just return the internal server error code ( 500 Status )
return StatusCode(StatusCodes.Status500InternalServerError);
CodePudding user response:
I'm assuming you are in the Controller.
protected IActionResult InternalServerError()
{
return StatusCode(StatusCodes.Status500InternalServerError);
}
But that would mean you have to go to url: /Home/InternalServerError
to get the error.