So I have this problem that I have endpoint like
[HttpGet("get/{id}")]
public async Task<IActionResult> Get([FromRoute] long? id)
{
if (id == null)
return BadRequest();
var result = await Mediator.Send(new GetIssueByIdQuery(id));
return CreateResponse(result);
}
and if I send request like
..../get/1
everything works fine. But if I give id parameter of different type, eg.:
.../get/asd
the server automagically responds with some generic validation error and 404. Since the request doesn't even hit the endpoint, how can I handle this situation myself and return some more descriptive information to the client?