When we setup an Azure Function (3) with bind parameter of DateTime, if someone calling the API has the wrong DateTime they just get a "500 Internal Server Error".
In the backend we get an error like this:
System.Private.CoreLib: Exception while executing function: XXX. Microsoft.Azure.WebJobs.Host: One or more errors occurred. (Exception binding parameter 'dateTime'). System.Private.CoreLib: String '2020-5-13T12:0t' was not recognized as a valid DateTime.
I want to return a BadRequestObject
with the specific parameters at fault.
The only way I can find to do this is make all parameters strings, and then try and parse them in code, and through an error if there is an issue.
Is there a better way?